From 8ebbb85117ddf7f600e4e40225629e910db4a4a6 Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Fri, 20 Dec 2019 23:00:04 +0100 Subject: [PATCH] Documentation for PhraseMatcher constructor (#4826) * add max_length as argument for init PhraseMatcher * improve error message too --- spacy/errors.py | 4 +++- website/docs/api/phrasematcher.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spacy/errors.py b/spacy/errors.py index 4dcdcae1a..dd2b38eb9 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -53,7 +53,9 @@ class Warnings(object): W009 = ("Custom factory '{name}' provided by entry points of another " "package overwrites built-in factory.") W010 = ("As of v2.1.0, the PhraseMatcher doesn't have a phrase length " - "limit anymore, so the max_length argument is now deprecated.") + "limit anymore, so the max_length argument is now deprecated. " + "If you did not specify this parameter, make sure you call the " + "constructor with named arguments instead of positional ones.") W011 = ("It looks like you're calling displacy.serve from within a " "Jupyter notebook or a similar environment. This likely means " "you're already running a local web server, so there's no need to " diff --git a/website/docs/api/phrasematcher.md b/website/docs/api/phrasematcher.md index c7311a401..90ecd3416 100644 --- a/website/docs/api/phrasematcher.md +++ b/website/docs/api/phrasematcher.md @@ -38,6 +38,7 @@ be shown. | Name | Type | Description | | --------------------------------------- | --------------- | ------------------------------------------------------------------------------------------- | | `vocab` | `Vocab` | The vocabulary object, which must be shared with the documents the matcher will operate on. | +| `max_length` | int | Deprecated argument - the `PhraseMatcher` does not have a phrase length limit anymore. | | `attr` 2.1 | int / unicode | The token attribute to match on. Defaults to `ORTH`, i.e. the verbatim token text. | | `validate` 2.1 | bool | Validate patterns added to the matcher. | | **RETURNS** | `PhraseMatcher` | The newly constructed object. |