Add warnings example in v2.3 migration guide (#5627)

This commit is contained in:
Adriane Boyd 2020-06-22 14:37:24 +02:00 committed by GitHub
parent 150a39ccca
commit bc1cb30b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,10 +161,18 @@ debugging your tokenizer configuration.
spaCy's custom warnings have been replaced with native Python spaCy's custom warnings have been replaced with native Python
[`warnings`](https://docs.python.org/3/library/warnings.html). Instead of [`warnings`](https://docs.python.org/3/library/warnings.html). Instead of
setting `SPACY_WARNING_IGNORE`, use the setting `SPACY_WARNING_IGNORE`, use the [`warnings`
[`warnings` filters](https://docs.python.org/3/library/warnings.html#the-warnings-filter) filters](https://docs.python.org/3/library/warnings.html#the-warnings-filter)
to manage warnings. 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 #### Normalization tables
The normalization tables have moved from the language data in The normalization tables have moved from the language data in