mirror of https://github.com/explosion/spaCy.git
Move max_length to nlp.make_doc() (#6512)
Move max_length check to `nlp.make_doc()` so that's it's also checked for `nlp.pipe()`.
This commit is contained in:
parent
52fa46dd58
commit
e931d3f72b
|
@ -434,10 +434,6 @@ class Language(object):
|
||||||
|
|
||||||
DOCS: https://spacy.io/api/language#call
|
DOCS: https://spacy.io/api/language#call
|
||||||
"""
|
"""
|
||||||
if len(text) > self.max_length:
|
|
||||||
raise ValueError(
|
|
||||||
Errors.E088.format(length=len(text), max_length=self.max_length)
|
|
||||||
)
|
|
||||||
doc = self.make_doc(text)
|
doc = self.make_doc(text)
|
||||||
if component_cfg is None:
|
if component_cfg is None:
|
||||||
component_cfg = {}
|
component_cfg = {}
|
||||||
|
@ -464,6 +460,10 @@ class Language(object):
|
||||||
return DisabledPipes(self, *names)
|
return DisabledPipes(self, *names)
|
||||||
|
|
||||||
def make_doc(self, text):
|
def make_doc(self, text):
|
||||||
|
if len(text) > self.max_length:
|
||||||
|
raise ValueError(
|
||||||
|
Errors.E088.format(length=len(text), max_length=self.max_length)
|
||||||
|
)
|
||||||
return self.tokenizer(text)
|
return self.tokenizer(text)
|
||||||
|
|
||||||
def _format_docs_and_golds(self, docs, golds):
|
def _format_docs_and_golds(self, docs, golds):
|
||||||
|
|
Loading…
Reference in New Issue