From fcdecefacf912fcd675a130fce6041ad0cfbc570 Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Mon, 22 Jun 2020 14:37:24 +0200 Subject: [PATCH] Add warnings example in v2.3 migration guide (#5627) --- website/docs/usage/v2-3.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/website/docs/usage/v2-3.md b/website/docs/usage/v2-3.md index d59b50a6e..378b1ec34 100644 --- a/website/docs/usage/v2-3.md +++ b/website/docs/usage/v2-3.md @@ -161,10 +161,18 @@ debugging your tokenizer configuration. spaCy's custom warnings have been replaced with native Python [`warnings`](https://docs.python.org/3/library/warnings.html). Instead of -setting `SPACY_WARNING_IGNORE`, use the -[`warnings` filters](https://docs.python.org/3/library/warnings.html#the-warnings-filter) +setting `SPACY_WARNING_IGNORE`, use the [`warnings` +filters](https://docs.python.org/3/library/warnings.html#the-warnings-filter) to manage warnings. +```diff +import spacy ++ import warnings + +- spacy.errors.SPACY_WARNING_IGNORE.append('W007') ++ warnings.filterwarnings("ignore", message=r"\[W007\]", category=UserWarning) +``` + #### Normalization tables The normalization tables have moved from the language data in