mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Improve E889
This commit is contained in:
parent
924396c20c
commit
94232aea08
|
@ -483,9 +483,10 @@ class Errors:
|
|||
"component that doesn't seem to support listeners. Expected Tok2Vec "
|
||||
"or Transformer component. If you didn't call nlp.replace_listeners "
|
||||
"manually, this is likely a bug in spaCy.")
|
||||
E889 = ("Can't replace listeners of component '{name}' because it's not "
|
||||
"in the pipeline. Available components: {opts}. If you didn't call "
|
||||
"nlp.replace_listeners manually, this is likely a bug in spaCy.")
|
||||
E889 = ("Can't replace '{tok2vec}' listeners of component '{name}' because "
|
||||
"'{unknown}' is not in the pipeline. Available components: {opts}. "
|
||||
"If you didn't call nlp.replace_listeners manually, this is likely "
|
||||
"a bug in spaCy.")
|
||||
E890 = ("Cannot add the alias '{alias}' to the Knowledge base. "
|
||||
"Each alias should be a meaningful string.")
|
||||
E891 = ("Alias '{alias}' could not be added to the Knowledge base. "
|
||||
|
|
|
@ -1712,10 +1712,20 @@ class Language:
|
|||
DOCS: https://nightly.spacy.io/api/language#replace_listeners
|
||||
"""
|
||||
if tok2vec_name not in self.pipe_names:
|
||||
err = Errors.E889.format(name=tok2vec_name, opts=", ".join(self.pipe_names))
|
||||
err = Errors.E889.format(
|
||||
tok2vec=tok2vec_name,
|
||||
name=pipe_name,
|
||||
unknown=tok2vec_name,
|
||||
opts=", ".join(self.pipe_names),
|
||||
)
|
||||
raise ValueError(err)
|
||||
if pipe_name not in self.pipe_names:
|
||||
err = Errors.E889.format(name=pipe_name, opts=", ".join(self.pipe_names))
|
||||
err = Errors.E889.format(
|
||||
tok2vec=tok2vec_name,
|
||||
name=pipe_name,
|
||||
unknown=pipe_name,
|
||||
opts=", ".join(self.pipe_names),
|
||||
)
|
||||
raise ValueError(err)
|
||||
tok2vec = self.get_pipe(tok2vec_name)
|
||||
tok2vec_cfg = self.get_pipe_config(tok2vec_name)
|
||||
|
|
Loading…
Reference in New Issue
Block a user