mirror of https://github.com/explosion/spaCy.git
Add deprecation warning for PhraseMatcher max_length
This commit is contained in:
parent
64257bf3a7
commit
bd1b0e396a
|
@ -48,6 +48,8 @@ class Warnings(object):
|
|||
W008 = ("Evaluating {obj}.similarity based on empty vectors.")
|
||||
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.")
|
||||
|
||||
|
||||
@add_codes
|
||||
|
@ -268,6 +270,8 @@ class Errors(object):
|
|||
"NBOR_RELOP.")
|
||||
E101 = ("NODE_NAME should be a new node and NBOR_NAME should already have "
|
||||
"have been declared in previous edges.")
|
||||
|
||||
|
||||
@add_codes
|
||||
class TempErrors(object):
|
||||
T001 = ("Max length currently 10 for phrase matching")
|
||||
|
|
|
@ -14,6 +14,7 @@ from .tokens.doc cimport Doc
|
|||
from .tokens.doc cimport get_token_attr
|
||||
from .attrs cimport ID, attr_id_t, NULL_ATTR
|
||||
from .errors import Errors, TempErrors
|
||||
from .errors import Errors, TempErrors, Warnings, deprecation_warning
|
||||
|
||||
from .attrs import IDS
|
||||
from .attrs import FLAG61 as U_ENT
|
||||
|
@ -550,7 +551,8 @@ cdef class PhraseMatcher:
|
|||
cdef public object _patterns
|
||||
|
||||
def __init__(self, Vocab vocab, max_length=0):
|
||||
# TODO: Add deprecation warning on max_length
|
||||
if max_length != 0:
|
||||
deprecation_warning(Warnings.W010)
|
||||
self.mem = Pool()
|
||||
self.max_length = max_length
|
||||
self.vocab = vocab
|
||||
|
|
Loading…
Reference in New Issue