2021-05-31 08:20:27 +00:00
|
|
|
import warnings
|
2022-05-25 07:33:54 +00:00
|
|
|
from .compat import Literal
|
2021-05-31 08:20:27 +00:00
|
|
|
|
|
|
|
|
2021-11-03 14:29:32 +00:00
|
|
|
class ErrorsWithCodes(type):
|
|
|
|
def __getattribute__(self, code):
|
|
|
|
msg = super().__getattribute__(code)
|
|
|
|
if code.startswith("__"): # python system attributes like __class__
|
|
|
|
return msg
|
|
|
|
else:
|
|
|
|
return "[{code}] {msg}".format(code=code, msg=msg)
|
2018-04-03 13:50:31 +00:00
|
|
|
|
|
|
|
|
2021-05-31 08:20:27 +00:00
|
|
|
def setup_default_warnings():
|
|
|
|
# ignore certain numpy warnings
|
|
|
|
filter_warning("ignore", error_msg="numpy.dtype size changed") # noqa
|
|
|
|
filter_warning("ignore", error_msg="numpy.ufunc size changed") # noqa
|
|
|
|
|
2022-08-17 17:55:54 +00:00
|
|
|
# warn about entity_ruler, span_ruler & matcher having no patterns only once
|
|
|
|
for pipe in ["matcher", "entity_ruler", "span_ruler"]:
|
2021-05-31 08:20:27 +00:00
|
|
|
filter_warning("once", error_msg=Warnings.W036.format(name=pipe))
|
|
|
|
|
2021-06-04 15:44:04 +00:00
|
|
|
# warn once about lemmatizer without required POS
|
2021-10-12 17:56:44 +00:00
|
|
|
filter_warning("once", error_msg=Warnings.W108)
|
2021-06-04 15:44:04 +00:00
|
|
|
|
2021-10-27 12:08:31 +00:00
|
|
|
# floret vector table cannot be modified
|
|
|
|
filter_warning("once", error_msg="[W114]")
|
|
|
|
|
2021-05-31 08:20:27 +00:00
|
|
|
|
2022-05-25 07:33:54 +00:00
|
|
|
def filter_warning(
|
|
|
|
action: Literal["default", "error", "ignore", "always", "module", "once"],
|
|
|
|
error_msg: str,
|
|
|
|
):
|
2021-05-31 08:20:27 +00:00
|
|
|
"""Customize how spaCy should handle a certain warning.
|
|
|
|
|
|
|
|
error_msg (str): e.g. "W006", or a full error message
|
|
|
|
action (str): "default", "error", "ignore", "always", "module" or "once"
|
|
|
|
"""
|
|
|
|
warnings.filterwarnings(action, message=_escape_warning_msg(error_msg))
|
|
|
|
|
|
|
|
|
|
|
|
def _escape_warning_msg(msg):
|
|
|
|
"""To filter with warnings.filterwarnings, the [] brackets need to be escaped"""
|
|
|
|
return msg.replace("[", "\\[").replace("]", "\\]")
|
|
|
|
|
|
|
|
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
# fmt: off
|
|
|
|
|
2021-11-03 14:29:32 +00:00
|
|
|
class Warnings(metaclass=ErrorsWithCodes):
|
2018-04-03 13:50:31 +00:00
|
|
|
W005 = ("Doc object not parsed. This means displaCy won't be able to "
|
|
|
|
"generate a dependency visualization for it. Make sure the Doc "
|
|
|
|
"was processed with a model that supports dependency parsing, and "
|
|
|
|
"not just a language class like `English()`. For more info, see "
|
2021-01-30 09:09:38 +00:00
|
|
|
"the docs:\nhttps://spacy.io/usage/models")
|
2018-04-03 13:50:31 +00:00
|
|
|
W006 = ("No entities to visualize found in Doc object. If this is "
|
|
|
|
"surprising to you, make sure the Doc was processed using a model "
|
|
|
|
"that supports named entity recognition, and check the `doc.ents` "
|
|
|
|
"property manually if necessary.")
|
2018-05-20 23:22:38 +00:00
|
|
|
W007 = ("The model you're using has no word vectors loaded, so the result "
|
|
|
|
"of the {obj}.similarity method will be based on the tagger, "
|
|
|
|
"parser and NER, which may not give useful similarity judgements. "
|
|
|
|
"This may happen if you're using one of the small models, e.g. "
|
|
|
|
"`en_core_web_sm`, which don't ship with word vectors and only "
|
|
|
|
"use context-sensitive tensors. You can always add your own word "
|
|
|
|
"vectors, or use one of the larger models instead if available.")
|
|
|
|
W008 = ("Evaluating {obj}.similarity based on empty vectors.")
|
2018-12-20 16:32:04 +00:00
|
|
|
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 "
|
|
|
|
"make displaCy start another one. Instead, you should be able to "
|
|
|
|
"replace displacy.serve with displacy.render to show the "
|
|
|
|
"visualization.")
|
2019-02-12 14:45:31 +00:00
|
|
|
W012 = ("A Doc object you're adding to the PhraseMatcher for pattern "
|
|
|
|
"'{key}' is parsed and/or tagged, but to match on '{attr}', you "
|
|
|
|
"don't actually need this information. This means that creating "
|
|
|
|
"the patterns is potentially much slower, because all pipeline "
|
|
|
|
"components are applied. To only create tokenized Doc objects, "
|
|
|
|
"try using `nlp.make_doc(text)` or process all texts as a stream "
|
|
|
|
"using `list(nlp.tokenizer.pipe(all_texts))`.")
|
2019-10-14 10:28:53 +00:00
|
|
|
W017 = ("Alias '{alias}' already exists in the Knowledge Base.")
|
2019-12-13 09:45:29 +00:00
|
|
|
W018 = ("Entity '{entity}' already exists in the Knowledge Base - "
|
|
|
|
"ignoring the duplicate entry.")
|
2019-09-27 14:22:34 +00:00
|
|
|
W021 = ("Unexpected hash collision in PhraseMatcher. Matches may be "
|
|
|
|
"incorrect. Modify PhraseMatcher._terminal_hash to fix.")
|
2019-10-14 10:28:53 +00:00
|
|
|
W024 = ("Entity '{entity}' - Alias '{alias}' combination already exists in "
|
|
|
|
"the Knowledge Base.")
|
2020-09-21 11:01:26 +00:00
|
|
|
W026 = ("Unable to set all sentence boundaries from dependency parses. If "
|
|
|
|
"you are constructing a parse tree incrementally by setting "
|
|
|
|
"token.head values, you can probably ignore this warning. Consider "
|
|
|
|
"using Doc(words, ..., heads=heads, deps=deps) instead.")
|
2019-12-21 20:12:19 +00:00
|
|
|
W027 = ("Found a large training file of {size} bytes. Note that it may "
|
|
|
|
"be more efficient to split your training data into multiple "
|
|
|
|
"smaller JSON files instead.")
|
2020-07-09 17:43:39 +00:00
|
|
|
W028 = ("Doc.from_array was called with a vector of type '{type}', "
|
2020-10-04 09:16:31 +00:00
|
|
|
"but is expecting one of type uint64 instead. This may result "
|
2020-07-09 17:43:39 +00:00
|
|
|
"in problems with the vocab further on in the pipeline.")
|
2020-05-19 14:01:18 +00:00
|
|
|
W030 = ("Some entities could not be aligned in the text \"{text}\" with "
|
|
|
|
"entities \"{entities}\". Use "
|
2020-09-22 09:50:19 +00:00
|
|
|
"`spacy.training.offsets_to_biluo_tags(nlp.make_doc(text), entities)`"
|
2020-05-19 14:01:18 +00:00
|
|
|
" to check the alignment. Misaligned entities ('-') will be "
|
|
|
|
"ignored during training.")
|
2020-06-15 12:56:04 +00:00
|
|
|
W033 = ("Training a new {model} using a model with no lexeme normalization "
|
|
|
|
"table. This may degrade the performance of the model to some "
|
|
|
|
"degree. If this is intentional or the language you're using "
|
|
|
|
"doesn't have a normalization table, please ignore this warning. "
|
|
|
|
"If this is surprising, make sure you have the spacy-lookups-data "
|
2021-03-19 09:45:16 +00:00
|
|
|
"package installed and load the table in your config. The "
|
|
|
|
"languages with lexeme normalization tables are currently: "
|
|
|
|
"{langs}\n\nLoad the table in your config with:\n\n"
|
|
|
|
"[initialize.lookups]\n"
|
|
|
|
"@misc = \"spacy.LookupsDataLoader.v1\"\n"
|
|
|
|
"lang = ${{nlp.lang}}\n"
|
|
|
|
"tables = [\"lexeme_norm\"]\n")
|
2021-05-31 08:20:27 +00:00
|
|
|
W035 = ("Discarding subpattern '{pattern}' due to an unrecognized "
|
2020-08-05 12:56:14 +00:00
|
|
|
"attribute or operator.")
|
2021-05-31 08:20:27 +00:00
|
|
|
W036 = ("The component '{name}' does not have any patterns defined.")
|
2018-04-03 13:50:31 +00:00
|
|
|
|
2021-01-30 01:34:09 +00:00
|
|
|
# New warnings added in v3.x
|
2021-01-26 03:51:52 +00:00
|
|
|
W086 = ("Component '{listener}' will be (re)trained, but it needs the component "
|
2021-08-26 07:50:35 +00:00
|
|
|
"'{name}' which is frozen. If you want to prevent retraining '{name}' "
|
|
|
|
"but want to train '{listener}' on top of it, you should add '{name}' to the "
|
|
|
|
"list of 'annotating_components' in the 'training' block in the config. "
|
|
|
|
"See the documentation for details: "
|
|
|
|
"https://spacy.io/usage/training#annotating-components")
|
2021-01-26 03:51:52 +00:00
|
|
|
W087 = ("Component '{name}' will be (re)trained, but the component '{listener}' "
|
2021-01-29 12:46:01 +00:00
|
|
|
"depends on it via a listener and is frozen. This means that the "
|
|
|
|
"performance of '{listener}' will be degraded. You can either freeze "
|
|
|
|
"both, or neither of the two. If you're sourcing the component from "
|
|
|
|
"an existing pipeline, you can use the `replace_listeners` setting in "
|
|
|
|
"the config block to replace its token-to-vector listener with a copy "
|
|
|
|
"and make it independent. For example, `replace_listeners = "
|
|
|
|
"[\"model.tok2vec\"]` See the documentation for details: "
|
2021-01-30 09:09:38 +00:00
|
|
|
"https://spacy.io/usage/training#config-components-listeners")
|
2020-10-04 09:16:31 +00:00
|
|
|
W088 = ("The pipeline component {name} implements a `begin_training` "
|
|
|
|
"method, which won't be called by spaCy. As of v3.0, `begin_training` "
|
|
|
|
"has been renamed to `initialize`, so you likely want to rename the "
|
2020-10-04 08:11:27 +00:00
|
|
|
"component method. See the documentation for details: "
|
2021-01-30 09:09:38 +00:00
|
|
|
"https://spacy.io/api/language#initialize")
|
2020-10-04 09:16:31 +00:00
|
|
|
W089 = ("As of spaCy v3.0, the `nlp.begin_training` method has been renamed "
|
|
|
|
"to `nlp.initialize`.")
|
2020-09-25 13:47:10 +00:00
|
|
|
W090 = ("Could not locate any {format} files in path '{path}'.")
|
2020-06-29 16:22:33 +00:00
|
|
|
W091 = ("Could not clean/remove the temp directory at {dir}: {msg}.")
|
2020-06-29 12:33:00 +00:00
|
|
|
W092 = ("Ignoring annotations for sentence starts, as dependency heads are set.")
|
2020-06-26 17:34:12 +00:00
|
|
|
W093 = ("Could not find any data to train the {name} on. Is your "
|
2020-08-18 14:06:37 +00:00
|
|
|
"input data correctly formatted?")
|
2020-06-05 10:42:15 +00:00
|
|
|
W094 = ("Model '{model}' ({model_version}) specifies an under-constrained "
|
|
|
|
"spaCy version requirement: {version}. This can lead to compatibility "
|
|
|
|
"problems with older versions, or as new spaCy versions are "
|
|
|
|
"released, because the model may say it's compatible when it's "
|
|
|
|
'not. Consider changing the "spacy_version" in your meta.json to a '
|
|
|
|
"version range, with a lower and upper pin. For example: {example}")
|
2021-06-21 07:39:22 +00:00
|
|
|
W095 = ("Model '{model}' ({model_version}) was trained with spaCy "
|
|
|
|
"{version} and may not be 100% compatible with the current version "
|
|
|
|
"({current}). If you see errors or degraded performance, download "
|
|
|
|
"a newer compatible model or retrain your custom model with the "
|
|
|
|
"current spaCy version. For more details and available updates, "
|
|
|
|
"run: python -m spacy validate")
|
2020-10-04 09:16:31 +00:00
|
|
|
W096 = ("The method `nlp.disable_pipes` is now deprecated - use "
|
|
|
|
"`nlp.select_pipes` instead.")
|
2020-06-29 12:33:00 +00:00
|
|
|
W100 = ("Skipping unsupported morphological feature(s): '{feature}'. "
|
2020-06-03 12:36:59 +00:00
|
|
|
"Provide features as a dict {{\"Field1\": \"Value1,Value2\"}} or "
|
|
|
|
"string \"Field1=Value1,Value2|Field2=Value3\".")
|
2020-10-04 09:16:31 +00:00
|
|
|
W101 = ("Skipping Doc custom extension '{name}' while merging docs.")
|
2020-07-03 09:32:42 +00:00
|
|
|
W102 = ("Skipping unsupported user data '{key}: {value}' while merging docs.")
|
2020-07-19 11:34:37 +00:00
|
|
|
W103 = ("Unknown {lang} word segmenter '{segmenter}'. Supported "
|
|
|
|
"word segmenters: {supported}. Defaulting to {default}.")
|
|
|
|
W104 = ("Skipping modifications for '{target}' segmenter. The current "
|
|
|
|
"segmenter is '{current}'.")
|
2020-10-04 09:16:31 +00:00
|
|
|
W105 = ("As of spaCy v3.0, the `{matcher}.pipe` method is deprecated. If you "
|
|
|
|
"need to match on a stream of documents, you can use `nlp.pipe` and "
|
2020-08-31 15:01:24 +00:00
|
|
|
"call the {matcher} on each Doc object.")
|
2020-10-04 09:16:31 +00:00
|
|
|
W107 = ("The property `Doc.{prop}` is deprecated. Use "
|
|
|
|
"`Doc.has_annotation(\"{attr}\")` instead.")
|
2021-10-12 17:56:44 +00:00
|
|
|
W108 = ("The rule-based lemmatizer did not find POS annotation for one or "
|
|
|
|
"more tokens. Check that your pipeline includes components that "
|
2020-12-04 10:46:15 +00:00
|
|
|
"assign token.pos, typically 'tagger'+'attribute_ruler' or "
|
|
|
|
"'morphologizer'.")
|
2020-12-29 10:54:32 +00:00
|
|
|
W109 = ("Unable to save user hooks while serializing the doc. Re-add any "
|
|
|
|
"required user hooks to the doc after processing.")
|
2021-01-29 00:52:01 +00:00
|
|
|
W110 = ("The DependencyMatcher token pattern {pattern} matched a span "
|
|
|
|
"{tokens} that is 2+ tokens long. Only the first token in the span "
|
|
|
|
"will be included in the results. For better results, token "
|
|
|
|
"patterns should return matches that are each exactly one token "
|
|
|
|
"long.")
|
2021-03-09 14:35:21 +00:00
|
|
|
W111 = ("Jupyter notebook detected: if using `prefer_gpu()` or "
|
|
|
|
"`require_gpu()`, include it in the same cell right before "
|
|
|
|
"`spacy.load()` to ensure that the model is loaded on the correct "
|
|
|
|
"device. More information: "
|
|
|
|
"http://spacy.io/usage/v3#jupyter-notebook-gpu")
|
2021-04-04 18:20:24 +00:00
|
|
|
W112 = ("The model specified to use for initial vectors ({name}) has no "
|
|
|
|
"vectors. This is almost certainly a mistake.")
|
2021-04-19 08:36:32 +00:00
|
|
|
W113 = ("Sourced component '{name}' may not work as expected: source "
|
|
|
|
"vectors are not identical to current pipeline vectors.")
|
2021-10-21 14:14:23 +00:00
|
|
|
W114 = ("Using multiprocessing with GPU models is not recommended and may "
|
|
|
|
"lead to errors.")
|
2021-10-27 12:08:31 +00:00
|
|
|
W115 = ("Skipping {method}: the floret vector table cannot be modified. "
|
|
|
|
"Vectors are calculated from character ngrams.")
|
2021-11-23 14:33:33 +00:00
|
|
|
W116 = ("Unable to clean attribute '{attr}'.")
|
2022-03-16 17:14:34 +00:00
|
|
|
W117 = ("No spans to visualize found in Doc object with spans_key: '{spans_key}'. If this is "
|
|
|
|
"surprising to you, make sure the Doc was processed using a model "
|
|
|
|
"that supports span categorization, and check the `doc.spans[spans_key]` "
|
|
|
|
"property manually if necessary.")
|
2022-04-12 08:48:28 +00:00
|
|
|
W118 = ("Term '{term}' not found in glossary. It may however be explained in documentation "
|
|
|
|
"for the corpora used to train the language. Please check "
|
|
|
|
"`nlp.meta[\"sources\"]` for any relevant links.")
|
2022-05-12 09:46:08 +00:00
|
|
|
W119 = ("Overriding pipe name in `config` is not supported. Ignoring override '{name_in_config}'.")
|
2022-06-02 13:56:27 +00:00
|
|
|
W120 = ("Unable to load all spans in Doc.spans: more than one span group "
|
|
|
|
"with the name '{group_name}' was found in the saved spans data. "
|
|
|
|
"Only the last span group will be loaded under "
|
|
|
|
"Doc.spans['{group_name}']. Skipping span group with values: "
|
|
|
|
"{group_values}")
|
2022-06-30 09:28:12 +00:00
|
|
|
W121 = ("Attempting to trace non-existent method '{method}' in pipe '{pipe}'")
|
|
|
|
W122 = ("Couldn't trace method '{method}' in pipe '{pipe}'. This can happen if the pipe class "
|
|
|
|
"is a Cython extension type.")
|
2022-11-08 13:58:10 +00:00
|
|
|
W123 = ("Argument `enable` with value {enable} does not contain all values specified in the config option "
|
|
|
|
"`enabled` ({enabled}). Be aware that this might affect other components in your pipeline.")
|
2020-02-27 17:42:27 +00:00
|
|
|
|
2020-05-21 12:14:01 +00:00
|
|
|
|
2021-11-03 14:29:32 +00:00
|
|
|
class Errors(metaclass=ErrorsWithCodes):
|
2018-04-03 13:50:31 +00:00
|
|
|
E001 = ("No component '{name}' found in pipeline. Available names: {opts}")
|
2020-07-22 11:42:59 +00:00
|
|
|
E002 = ("Can't find factory for '{name}' for language {lang} ({lang_code}). "
|
2020-11-09 20:42:58 +00:00
|
|
|
"This usually happens when spaCy calls `nlp.{method}` with a custom "
|
2020-07-22 11:42:59 +00:00
|
|
|
"component name that's not registered on the current language class. "
|
2020-11-09 20:42:58 +00:00
|
|
|
"If you're using a Transformer, make sure to install 'spacy-transformers'. "
|
2020-07-22 11:42:59 +00:00
|
|
|
"If you're using a custom component, make sure you've added the "
|
2020-10-04 09:16:31 +00:00
|
|
|
"decorator `@Language.component` (for function components) or "
|
|
|
|
"`@Language.factory` (for class components).\n\nAvailable "
|
2020-07-22 11:42:59 +00:00
|
|
|
"factories: {opts}")
|
2018-04-03 13:50:31 +00:00
|
|
|
E003 = ("Not a valid pipeline component. Expected callable, but "
|
2020-07-22 11:42:59 +00:00
|
|
|
"got {component} (name: '{name}'). If you're using a custom "
|
|
|
|
"component factory, double-check that it correctly returns your "
|
|
|
|
"initialized component.")
|
2020-08-28 14:27:22 +00:00
|
|
|
E004 = ("Can't set up pipeline component: a factory for '{name}' already "
|
|
|
|
"exists. Existing factory: {func}. New factory: {new_func}")
|
2022-09-01 17:37:23 +00:00
|
|
|
E005 = ("Pipeline component '{name}' returned {returned_type} instead of a "
|
|
|
|
"Doc. If you're using a custom component, maybe you forgot to "
|
|
|
|
"return the processed Doc?")
|
2020-07-22 11:42:59 +00:00
|
|
|
E006 = ("Invalid constraints for adding pipeline component. You can only "
|
|
|
|
"set one of the following: before (component name or index), "
|
|
|
|
"after (component name or index), first (True) or last (True). "
|
|
|
|
"Invalid configuration: {args}. Existing components: {opts}")
|
2018-04-03 13:50:31 +00:00
|
|
|
E007 = ("'{name}' already exists in pipeline. Existing names: {opts}")
|
2020-08-28 18:35:26 +00:00
|
|
|
E008 = ("Can't restore disabled pipeline component '{name}' because it "
|
|
|
|
"doesn't exist in the pipeline anymore. If you want to remove "
|
|
|
|
"components from the pipeline, you should do it before calling "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`nlp.select_pipes` or after restoring the disabled components.")
|
2018-04-03 13:50:31 +00:00
|
|
|
E010 = ("Word vectors set to length 0. This may be because you don't have "
|
|
|
|
"a model installed or loaded, or because your model doesn't "
|
|
|
|
"include word vectors. For more info, see the docs:\n"
|
2021-01-30 09:09:38 +00:00
|
|
|
"https://spacy.io/usage/models")
|
2018-04-03 13:50:31 +00:00
|
|
|
E011 = ("Unknown operator: '{op}'. Options: {opts}")
|
|
|
|
E012 = ("Cannot add pattern for zero tokens to matcher.\nKey: {key}")
|
|
|
|
E016 = ("MultitaskObjective target should be function or one of: dep, "
|
|
|
|
"tag, ent, dep_tag_offset, ent_tag.")
|
|
|
|
E017 = ("Can only add unicode or bytes. Got type: {value_type}")
|
2019-08-20 14:03:45 +00:00
|
|
|
E018 = ("Can't retrieve string for hash '{hash_value}'. This usually "
|
|
|
|
"refers to an issue with the `Vocab` or `StringStore`.")
|
2018-04-03 13:50:31 +00:00
|
|
|
E019 = ("Can't create transition with unknown action ID: {action}. Action "
|
|
|
|
"IDs are enumerated in spacy/syntax/{src}.pyx.")
|
|
|
|
E022 = ("Could not find a transition with the name '{name}' in the NER "
|
|
|
|
"model.")
|
|
|
|
E024 = ("Could not find an optimal move to supervise the parser. Usually, "
|
2019-06-01 12:37:27 +00:00
|
|
|
"this means that the model can't be updated in a way that's valid "
|
|
|
|
"and satisfies the correct annotations specified in the GoldParse. "
|
|
|
|
"For example, are all labels added to the model? If you're "
|
|
|
|
"training a named entity recognizer, also make sure that none of "
|
2020-01-06 13:59:28 +00:00
|
|
|
"your annotated entity spans have leading or trailing whitespace "
|
2020-10-04 09:16:31 +00:00
|
|
|
"or punctuation. You can also use the `debug data` command to "
|
2019-06-01 12:37:27 +00:00
|
|
|
"validate your JSON-formatted training data. For details, run:\n"
|
2020-08-06 13:47:31 +00:00
|
|
|
"python -m spacy debug data --help")
|
2018-04-03 13:50:31 +00:00
|
|
|
E025 = ("String is too long: {length} characters. Max is 2**30.")
|
|
|
|
E026 = ("Error accessing token at position {i}: out of bounds in Doc of "
|
|
|
|
"length {length}.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E027 = ("Arguments `words` and `spaces` should be sequences of the same "
|
|
|
|
"length, or `spaces` should be left default at None. `spaces` "
|
2018-04-03 13:50:31 +00:00
|
|
|
"should be a sequence of booleans, with True meaning that the "
|
|
|
|
"word owns a ' ' character following it.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E028 = ("`words` expects a list of unicode strings, but got bytes instance: {value}")
|
|
|
|
E029 = ("`noun_chunks` requires the dependency parse, which requires a "
|
2018-04-03 13:50:31 +00:00
|
|
|
"statistical model to be installed and loaded. For more info, see "
|
2021-01-30 09:09:38 +00:00
|
|
|
"the documentation:\nhttps://spacy.io/usage/models")
|
2018-04-03 13:50:31 +00:00
|
|
|
E030 = ("Sentence boundaries unset. You can add the 'sentencizer' "
|
2020-10-04 09:16:31 +00:00
|
|
|
"component to the pipeline with: `nlp.add_pipe('sentencizer')`. "
|
2020-10-04 13:26:01 +00:00
|
|
|
"Alternatively, add the dependency parser or sentence recognizer, "
|
|
|
|
"or set sentence boundaries by setting `doc[i].is_sent_start`.")
|
2018-04-03 13:50:31 +00:00
|
|
|
E031 = ("Invalid token: empty string ('') at position {i}.")
|
|
|
|
E033 = ("Cannot load into non-empty Doc of length {length}.")
|
|
|
|
E035 = ("Error creating span with start {start} and end {end} for Doc of "
|
|
|
|
"length {length}.")
|
|
|
|
E036 = ("Error calculating span: Can't find a token starting at character "
|
|
|
|
"offset {start}.")
|
|
|
|
E037 = ("Error calculating span: Can't find a token ending at character "
|
|
|
|
"offset {end}.")
|
|
|
|
E039 = ("Array bounds exceeded while searching for root word. This likely "
|
|
|
|
"means the parse tree is in an invalid state. Please report this "
|
|
|
|
"issue here: http://github.com/explosion/spaCy/issues")
|
|
|
|
E040 = ("Attempt to access token at {i}, max length {max_length}.")
|
|
|
|
E041 = ("Invalid comparison operator: {op}. Likely a Cython bug?")
|
2020-10-04 09:16:31 +00:00
|
|
|
E042 = ("Error accessing `doc[{i}].nbor({j})`, for doc of length {length}.")
|
2018-04-03 13:50:31 +00:00
|
|
|
E043 = ("Refusing to write to token.sent_start if its document is parsed, "
|
|
|
|
"because this may cause inconsistent state.")
|
|
|
|
E044 = ("Invalid value for token.sent_start: {value}. Must be one of: "
|
|
|
|
"None, True, False")
|
|
|
|
E045 = ("Possibly infinite loop encountered while looking for {attr}.")
|
|
|
|
E046 = ("Can't retrieve unregistered extension attribute '{name}'. Did "
|
|
|
|
"you forget to call the `set_extension` method?")
|
|
|
|
E047 = ("Can't assign a value to unregistered extension attribute "
|
|
|
|
"'{name}'. Did you forget to call the `set_extension` method?")
|
2021-10-05 07:52:22 +00:00
|
|
|
E048 = ("Can't import language {lang} or any matching language from spacy.lang: {err}")
|
2020-02-18 16:20:17 +00:00
|
|
|
E050 = ("Can't find model '{name}'. It doesn't seem to be a Python "
|
|
|
|
"package or a valid path to a data directory.")
|
2018-04-03 13:50:31 +00:00
|
|
|
E052 = ("Can't find model directory: {path}")
|
2020-02-27 17:42:27 +00:00
|
|
|
E053 = ("Could not read {name} from {path}")
|
2018-04-03 13:50:31 +00:00
|
|
|
E054 = ("No valid '{setting}' setting found in model meta.json.")
|
|
|
|
E055 = ("Invalid ORTH value in exception:\nKey: {key}\nOrths: {orths}")
|
|
|
|
E056 = ("Invalid tokenizer exception: ORTH values combined don't match "
|
|
|
|
"original string.\nKey: {key}\nOrths: {orths}")
|
|
|
|
E057 = ("Stepped slices not supported in Span objects. Try: "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`list(tokens)[start:stop:step]` instead.")
|
2018-04-03 13:50:31 +00:00
|
|
|
E058 = ("Could not retrieve vector for key {key}.")
|
|
|
|
E059 = ("One (and only one) keyword arg must be set. Got: {kwargs}")
|
|
|
|
E060 = ("Cannot add new key to vectors: the table is full. Current shape: "
|
|
|
|
"({rows}, {cols}).")
|
|
|
|
E062 = ("Cannot find empty bit for new lexical flag. All bits between 0 "
|
|
|
|
"and 63 are occupied. You can replace one by specifying the "
|
|
|
|
"`flag_id` explicitly, e.g. "
|
|
|
|
"`nlp.vocab.add_flag(your_func, flag_id=IS_ALPHA`.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E063 = ("Invalid value for `flag_id`: {value}. Flag IDs must be between 1 "
|
2018-04-03 13:50:31 +00:00
|
|
|
"and 63 (inclusive).")
|
|
|
|
E064 = ("Error fetching a Lexeme from the Vocab. When looking up a "
|
|
|
|
"string, the lexeme returned had an orth ID that did not match "
|
|
|
|
"the query string. This means that the cached lexeme structs are "
|
|
|
|
"mismatched to the string encoding table. The mismatched:\n"
|
|
|
|
"Query string: {string}\nOrth cached: {orth}\nOrth ID: {orth_id}")
|
|
|
|
E065 = ("Only one of the vector table's width and shape can be specified. "
|
|
|
|
"Got width {width} and shape {shape}.")
|
2020-09-08 20:44:25 +00:00
|
|
|
E067 = ("Invalid BILUO tag sequence: Got a tag starting with {start} "
|
|
|
|
"without a preceding 'B' (beginning of an entity). "
|
2018-04-03 13:50:31 +00:00
|
|
|
"Tag sequence:\n{tags}")
|
|
|
|
E068 = ("Invalid BILUO tag: '{tag}'.")
|
|
|
|
E071 = ("Error creating lexeme: specified orth ID ({orth}) does not "
|
|
|
|
"match the one in the vocab ({vocab_orth}).")
|
|
|
|
E073 = ("Cannot assign vector of length {new_length}. Existing vectors "
|
|
|
|
"are of length {length}. You can use `vocab.reset_vectors` to "
|
|
|
|
"clear the existing vectors and resize the table.")
|
|
|
|
E074 = ("Error interpreting compiled match pattern: patterns are expected "
|
|
|
|
"to end with the attribute {attr}. Got: {bad_attr}.")
|
|
|
|
E082 = ("Error deprojectivizing parse: number of heads ({n_heads}), "
|
|
|
|
"projective heads ({n_proj_heads}) and labels ({n_labels}) do not "
|
|
|
|
"match.")
|
2018-04-03 16:30:17 +00:00
|
|
|
E083 = ("Error setting extension: only one of `default`, `method`, or "
|
|
|
|
"`getter` (plus optional `setter`) is allowed. Got: {nr_defined}")
|
2018-04-03 13:50:31 +00:00
|
|
|
E084 = ("Error assigning label ID {label} to span: not in StringStore.")
|
|
|
|
E085 = ("Can't create lexeme for string '{string}'.")
|
|
|
|
E087 = ("Unknown displaCy style: {style}.")
|
|
|
|
E088 = ("Text of length {length} exceeds maximum of {max_length}. The "
|
2020-10-04 09:16:31 +00:00
|
|
|
"parser and NER models require roughly 1GB of temporary "
|
2018-04-03 13:50:31 +00:00
|
|
|
"memory per 100,000 characters in the input. This means long "
|
|
|
|
"texts may cause memory allocation errors. If you're not using "
|
|
|
|
"the parser or NER, it's probably safe to increase the "
|
|
|
|
"`nlp.max_length` limit. The limit is in number of characters, so "
|
|
|
|
"you can check whether your inputs are too long by checking "
|
|
|
|
"`len(text)`.")
|
2018-04-03 16:30:17 +00:00
|
|
|
E089 = ("Extensions can't have a setter argument without a getter "
|
|
|
|
"argument. Check the keyword arguments on `set_extension`.")
|
|
|
|
E090 = ("Extension '{name}' already exists on {obj}. To overwrite the "
|
|
|
|
"existing extension, set `force=True` on `{obj}.set_extension`.")
|
|
|
|
E091 = ("Invalid extension attribute {name}: expected callable or None, "
|
|
|
|
"but got: {value}")
|
2018-04-03 19:40:29 +00:00
|
|
|
E093 = ("token.ent_iob values make invalid sequence: I without B\n{seq}")
|
2018-04-10 19:26:37 +00:00
|
|
|
E094 = ("Error reading line {line_num} in vectors file {loc}.")
|
2018-05-20 13:13:37 +00:00
|
|
|
E095 = ("Can't write to frozen dictionary. This is likely an internal "
|
|
|
|
"error. Are you writing to a default function argument?")
|
2020-10-04 09:16:31 +00:00
|
|
|
E096 = ("Invalid object passed to displaCy: Can only visualize `Doc` or "
|
|
|
|
"Span objects, or dicts if set to `manual=True`.")
|
2018-07-18 17:43:16 +00:00
|
|
|
E097 = ("Invalid pattern: expected token pattern (list of dicts) or "
|
|
|
|
"phrase pattern (string) but got:\n{pattern}")
|
2020-08-31 18:04:26 +00:00
|
|
|
E098 = ("Invalid pattern: expected both RIGHT_ID and RIGHT_ATTRS.")
|
|
|
|
E099 = ("Invalid pattern: the first node of pattern should be an anchor "
|
|
|
|
"node. The node should only contain RIGHT_ID and RIGHT_ATTRS.")
|
2021-08-04 07:20:41 +00:00
|
|
|
E100 = ("Nodes other than the anchor node should all contain {required}, "
|
|
|
|
"but these are missing: {missing}")
|
2020-08-31 18:04:26 +00:00
|
|
|
E101 = ("RIGHT_ID should be a new node and LEFT_ID should already have "
|
2018-10-29 22:21:39 +00:00
|
|
|
"have been declared in previous edges.")
|
2019-02-24 14:11:28 +00:00
|
|
|
E102 = ("Can't merge non-disjoint spans. '{token}' is already part of "
|
2019-10-01 19:59:50 +00:00
|
|
|
"tokens to merge. If you want to find the longest non-overlapping "
|
|
|
|
"spans, you can use the util.filter_spans helper:\n"
|
2021-01-30 09:09:38 +00:00
|
|
|
"https://spacy.io/api/top-level#util.filter_spans")
|
2019-08-20 14:03:45 +00:00
|
|
|
E103 = ("Trying to set conflicting doc.ents: '{span1}' and '{span2}'. A "
|
|
|
|
"token can only be part of one entity, so make sure the entities "
|
2021-03-02 14:12:54 +00:00
|
|
|
"you're setting don't overlap. To work with overlapping entities, "
|
|
|
|
"consider using doc.spans instead.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E106 = ("Can't find `doc._.{attr}` attribute specified in the underscore "
|
2018-11-30 19:16:14 +00:00
|
|
|
"settings: {opts}")
|
2022-08-23 08:05:02 +00:00
|
|
|
E107 = ("Value of custom attribute `{attr}` is not JSON-serializable: {value}")
|
2020-02-27 17:42:27 +00:00
|
|
|
E109 = ("Component '{name}' could not be run. Did you forget to "
|
2020-10-04 09:16:31 +00:00
|
|
|
"call `initialize()`?")
|
2018-12-20 16:32:04 +00:00
|
|
|
E110 = ("Invalid displaCy render wrapper. Expected callable, got: {obj}")
|
2019-02-13 10:27:04 +00:00
|
|
|
E111 = ("Pickling a token is not supported, because tokens are only views "
|
|
|
|
"of the parent Doc and can't exist on their own. A pickled token "
|
|
|
|
"would always have to include its Doc and Vocab, which has "
|
|
|
|
"practically no advantage over pickling the parent Doc directly. "
|
|
|
|
"So instead of pickling the token, pickle the Doc it belongs to.")
|
2019-02-13 12:22:05 +00:00
|
|
|
E112 = ("Pickling a span is not supported, because spans are only views "
|
|
|
|
"of the parent Doc and can't exist on their own. A pickled span "
|
|
|
|
"would always have to include its Doc and Vocab, which has "
|
|
|
|
"practically no advantage over pickling the parent Doc directly. "
|
|
|
|
"So instead of pickling the span, pickle the Doc it belongs to or "
|
|
|
|
"use Span.as_doc to convert the span to a standalone Doc object.")
|
2019-02-24 14:11:28 +00:00
|
|
|
E115 = ("All subtokens must have associated heads.")
|
2019-02-15 16:32:31 +00:00
|
|
|
E117 = ("The newly split tokens must match the text of the original token. "
|
2019-02-17 11:22:07 +00:00
|
|
|
"New orths: {new}. Old text: {old}.")
|
2019-02-24 17:38:47 +00:00
|
|
|
E118 = ("The custom extension attribute '{attr}' is not registered on the "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`Token` object so it can't be set during retokenization. To "
|
|
|
|
"register an attribute, use the `Token.set_extension` classmethod.")
|
2019-08-20 14:03:45 +00:00
|
|
|
E119 = ("Can't set custom extension attribute '{attr}' during "
|
|
|
|
"retokenization because it's not writable. This usually means it "
|
|
|
|
"was registered with a getter function (and no setter) or as a "
|
|
|
|
"method extension, so the value is computed dynamically. To "
|
|
|
|
"overwrite a custom attribute manually, it should be registered "
|
|
|
|
"with a default value or with a getter AND setter.")
|
2019-02-24 17:38:47 +00:00
|
|
|
E120 = ("Can't set custom extension attributes during retokenization. "
|
|
|
|
"Expected dict mapping attribute names to values, but got: {value}")
|
2019-03-08 10:42:26 +00:00
|
|
|
E121 = ("Can't bulk merge spans. Attribute length {attr_len} should be "
|
|
|
|
"equal to span length ({span_len}).")
|
|
|
|
E122 = ("Cannot find token to be split. Did it get merged?")
|
|
|
|
E123 = ("Cannot find head of token to be split. Did it get merged?")
|
|
|
|
E125 = ("Unexpected value: {value}")
|
|
|
|
E126 = ("Unexpected matcher predicate: '{bad}'. Expected one of: {good}. "
|
|
|
|
"This is likely a bug in spaCy, so feel free to open an issue.")
|
2019-03-20 08:55:45 +00:00
|
|
|
E130 = ("You are running a narrow unicode build, which is incompatible "
|
|
|
|
"with spacy >= 2.1.0. To fix this, reinstall Python and use a wide "
|
|
|
|
"unicode build instead. You can also rebuild Python and set the "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`--enable-unicode=ucs4 flag`.")
|
2019-08-20 14:03:45 +00:00
|
|
|
E132 = ("The vectors for entities and probabilities for alias '{alias}' "
|
|
|
|
"should have equal length, but found {entities_length} and "
|
|
|
|
"{probabilities_length} respectively.")
|
|
|
|
E133 = ("The sum of prior probabilities for alias '{alias}' should not "
|
|
|
|
"exceed 1, but found {sum}.")
|
2019-10-14 10:28:53 +00:00
|
|
|
E134 = ("Entity '{entity}' is not defined in the Knowledge Base.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E139 = ("Knowledge base for component '{name}' is empty. Use the methods "
|
|
|
|
"`kb.add_entity` and `kb.add_alias` to add entries.")
|
2019-08-20 14:03:45 +00:00
|
|
|
E140 = ("The list of entities, prior probabilities and entity vectors "
|
|
|
|
"should be of equal length.")
|
|
|
|
E141 = ("Entity vectors should be of length {required} instead of the "
|
|
|
|
"provided {found}.")
|
2020-09-08 20:44:25 +00:00
|
|
|
E143 = ("Labels for component '{name}' not initialized. This can be fixed "
|
|
|
|
"by calling add_label, or by providing a representative batch of "
|
2020-10-04 09:16:31 +00:00
|
|
|
"examples to the component's `initialize` method.")
|
2019-07-22 12:36:07 +00:00
|
|
|
E145 = ("Error reading `{param}` from input file.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E146 = ("Could not access {path}.")
|
2019-08-20 14:03:45 +00:00
|
|
|
E147 = ("Unexpected error in the {method} functionality of the "
|
|
|
|
"EntityLinker: {msg}. This is likely a bug in spaCy, so feel free "
|
2020-10-04 09:16:31 +00:00
|
|
|
"to open an issue: https://github.com/explosion/spaCy/issues")
|
2019-08-20 14:03:45 +00:00
|
|
|
E148 = ("Expected {ents} KB identifiers but got {ids}. Make sure that "
|
|
|
|
"each entity in `doc.ents` is assigned to a KB identifier.")
|
|
|
|
E149 = ("Error deserializing model. Check that the config used to create "
|
|
|
|
"the component matches the model being loaded.")
|
|
|
|
E150 = ("The language of the `nlp` object and the `vocab` should be the "
|
|
|
|
"same, but found '{nlp}' and '{vocab}' respectively.")
|
2019-08-21 12:00:37 +00:00
|
|
|
E152 = ("The attribute {attr} is not supported for token patterns. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"Please use the option `validate=True` with the Matcher, PhraseMatcher, "
|
2022-05-25 09:12:29 +00:00
|
|
|
"EntityRuler or AttributeRuler for more details.")
|
2019-08-21 12:00:37 +00:00
|
|
|
E153 = ("The value type {vtype} is not supported for token patterns. "
|
|
|
|
"Please use the option validate=True with Matcher, PhraseMatcher, "
|
2022-05-25 09:12:29 +00:00
|
|
|
"EntityRuler or AttributeRuler for more details.")
|
2019-08-21 12:00:37 +00:00
|
|
|
E154 = ("One of the attributes or values is not supported for token "
|
2020-10-04 09:16:31 +00:00
|
|
|
"patterns. Please use the option `validate=True` with the Matcher, "
|
2019-08-21 12:00:37 +00:00
|
|
|
"PhraseMatcher, or EntityRuler for more details.")
|
2020-09-16 22:14:01 +00:00
|
|
|
E155 = ("The pipeline needs to include a {pipe} in order to use "
|
|
|
|
"Matcher or PhraseMatcher with the attribute {attr}. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"Try using `nlp()` instead of `nlp.make_doc()` or `list(nlp.pipe())` "
|
|
|
|
"instead of `list(nlp.tokenizer.pipe())`.")
|
2019-08-21 12:00:37 +00:00
|
|
|
E157 = ("Can't render negative values for dependency arc start or end. "
|
2019-08-20 13:51:37 +00:00
|
|
|
"Make sure that you're passing in absolute token indices, not "
|
|
|
|
"relative token offsets.\nstart: {start}, end: {end}, label: "
|
|
|
|
"{label}, direction: {dir}")
|
2019-09-09 17:17:55 +00:00
|
|
|
E158 = ("Can't add table '{name}' to lookups because it already exists.")
|
|
|
|
E159 = ("Can't find table '{name}' in lookups. Available tables: {tables}")
|
|
|
|
E160 = ("Can't find language data file: {path}")
|
2019-09-13 14:30:05 +00:00
|
|
|
E161 = ("Found an internal inconsistency when predicting entity links. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"This is likely a bug in spaCy, so feel free to open an issue: "
|
|
|
|
"https://github.com/explosion/spaCy/issues")
|
2019-09-15 20:31:31 +00:00
|
|
|
E163 = ("cumsum was found to be unstable: its last element does not "
|
|
|
|
"correspond to sum")
|
2020-10-04 09:16:31 +00:00
|
|
|
E164 = ("x is neither increasing nor decreasing: {x}.")
|
2020-10-18 12:50:41 +00:00
|
|
|
E165 = ("Only one class present in the gold labels: {label}. "
|
|
|
|
"ROC AUC score is not defined in that case.")
|
2020-10-02 13:43:32 +00:00
|
|
|
E166 = ("Can only merge DocBins with the same value for '{param}'.\n"
|
2019-09-18 18:23:21 +00:00
|
|
|
"Current DocBin: {current}\nOther DocBin: {other}")
|
2019-09-21 12:37:06 +00:00
|
|
|
E169 = ("Can't find module: {module}")
|
|
|
|
E170 = ("Cannot apply transition {name}: invalid for the current state.")
|
2020-07-29 09:04:43 +00:00
|
|
|
E171 = ("Matcher.add received invalid 'on_match' callback argument: expected "
|
2019-09-24 21:06:24 +00:00
|
|
|
"callable or None, but got: {arg_type}")
|
2019-10-10 12:01:53 +00:00
|
|
|
E175 = ("Can't remove rule for unknown match pattern ID: {key}")
|
2019-10-14 10:28:53 +00:00
|
|
|
E176 = ("Alias '{alias}' is not defined in the Knowledge Base.")
|
2019-10-21 10:20:28 +00:00
|
|
|
E177 = ("Ill-formed IOB input detected: {tag}")
|
2020-07-29 09:04:43 +00:00
|
|
|
E178 = ("Each pattern should be a list of dicts, but got: {pat}. Maybe you "
|
2019-10-25 20:21:08 +00:00
|
|
|
"accidentally passed a single pattern to Matcher.add instead of a "
|
|
|
|
"list of patterns? If you only want to add one pattern, make sure "
|
2020-10-04 09:16:31 +00:00
|
|
|
"to wrap it in a list. For example: `matcher.add('{key}', [pattern])`")
|
2019-10-25 20:21:08 +00:00
|
|
|
E179 = ("Invalid pattern. Expected a list of Doc objects but got a single "
|
|
|
|
"Doc. If you only want to add one pattern, make sure to wrap it "
|
2020-10-04 09:16:31 +00:00
|
|
|
"in a list. For example: `matcher.add('{key}', [doc])`")
|
2019-10-27 12:35:49 +00:00
|
|
|
E180 = ("Span attributes can't be declared as required or assigned by "
|
|
|
|
"components, since spans are only views of the Doc. Use Doc and "
|
2019-10-30 16:19:36 +00:00
|
|
|
"Token attributes (or custom extension attributes) only and remove "
|
|
|
|
"the following: {attrs}")
|
2022-02-10 12:45:46 +00:00
|
|
|
E181 = ("Received invalid attributes for unknown object {obj}: {attrs}. "
|
2019-10-27 12:35:49 +00:00
|
|
|
"Only Doc and Token attributes are supported.")
|
|
|
|
E182 = ("Received invalid attribute declaration: {attr}\nDid you forget "
|
2020-10-04 09:16:31 +00:00
|
|
|
"to define the attribute? For example: `{attr}.???`")
|
2019-10-27 12:35:49 +00:00
|
|
|
E183 = ("Received invalid attribute declaration: {attr}\nOnly top-level "
|
|
|
|
"attributes are supported, for example: {solution}")
|
|
|
|
E184 = ("Only attributes without underscores are supported in component "
|
|
|
|
"attribute declarations (because underscore and non-underscore "
|
|
|
|
"attributes are connected anyways): {attr} -> {solution}")
|
|
|
|
E185 = ("Received invalid attribute in component attribute declaration: "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`{obj}.{attr}`\nAttribute '{attr}' does not exist on {obj}.")
|
2019-11-21 15:24:10 +00:00
|
|
|
E187 = ("Only unicode strings are supported as labels.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E189 = ("Each argument to `Doc.__init__` should be of equal length.")
|
2020-03-03 20:44:51 +00:00
|
|
|
E190 = ("Token head out of range in `Doc.from_array()` for token index "
|
|
|
|
"'{index}' with value '{value}' (equivalent to relative head "
|
|
|
|
"index: '{rel_head_index}'). The head indices should be relative "
|
|
|
|
"to the current token index rather than absolute indices in the "
|
|
|
|
"array.")
|
|
|
|
E191 = ("Invalid head: the head token must be from the same doc as the "
|
|
|
|
"token itself.")
|
2020-03-29 11:51:20 +00:00
|
|
|
E192 = ("Unable to resize vectors in place with cupy.")
|
2020-04-02 08:43:13 +00:00
|
|
|
E193 = ("Unable to resize vectors in place if the resized vector dimension "
|
|
|
|
"({new_dim}) is not the same as the current vector dimension "
|
|
|
|
"({curr_dim}).")
|
2020-04-14 17:15:52 +00:00
|
|
|
E194 = ("Unable to aligned mismatched text '{text}' and words '{words}'.")
|
2020-04-15 11:51:33 +00:00
|
|
|
E195 = ("Matcher can be called on {good} only, got {got}.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E196 = ("Refusing to write to `token.is_sent_end`. Sentence boundaries can "
|
|
|
|
"only be fixed with `token.is_sent_start`.")
|
2020-05-13 20:08:28 +00:00
|
|
|
E197 = ("Row out of bounds, unable to add row {row} for key {key}.")
|
2020-05-19 14:41:26 +00:00
|
|
|
E198 = ("Unable to return {n} most similar vectors for the current vectors "
|
|
|
|
"table, which contains {n_rows} vectors.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E199 = ("Unable to merge 0-length span at `doc[{start}:{end}]`.")
|
2022-08-22 09:29:05 +00:00
|
|
|
E200 = ("Can't set {attr} from Span.")
|
2021-10-27 12:08:31 +00:00
|
|
|
E202 = ("Unsupported {name} mode '{mode}'. Supported modes: {modes}.")
|
2022-09-12 13:36:48 +00:00
|
|
|
E203 = ("If the {name} embedding layer is not updated "
|
|
|
|
"during training, make sure to include it in 'annotating components'")
|
2019-02-13 14:29:08 +00:00
|
|
|
|
2021-01-30 01:34:09 +00:00
|
|
|
# New errors added in v3.x
|
2022-11-17 09:25:01 +00:00
|
|
|
E851 = ("The 'textcat' component labels should only have values of 0 or 1, "
|
|
|
|
"but found value of '{val}'.")
|
2022-11-07 09:43:34 +00:00
|
|
|
E852 = ("The tar file pulled from the remote attempted an unsafe path "
|
|
|
|
"traversal.")
|
2022-08-19 07:52:12 +00:00
|
|
|
E853 = ("Unsupported component factory name '{name}'. The character '.' is "
|
|
|
|
"not permitted in factory names.")
|
2022-06-02 11:12:53 +00:00
|
|
|
E854 = ("Unable to set doc.ents. Check that the 'ents_filter' does not "
|
|
|
|
"permit overlapping spans.")
|
2022-04-01 07:56:26 +00:00
|
|
|
E855 = ("Invalid {obj}: {obj} is not from the same doc.")
|
|
|
|
E856 = ("Error accessing span at position {i}: out of bounds in span group "
|
|
|
|
"of length {length}.")
|
2022-03-28 09:13:50 +00:00
|
|
|
E857 = ("Entry '{name}' not found in edit tree lemmatizer labels.")
|
2021-10-27 12:08:31 +00:00
|
|
|
E858 = ("The {mode} vector table does not support this operation. "
|
|
|
|
"{alternative}")
|
|
|
|
E859 = ("The floret vector table cannot be modified.")
|
2022-03-30 06:54:23 +00:00
|
|
|
E860 = ("Can't truncate floret vectors.")
|
2021-10-27 12:08:31 +00:00
|
|
|
E861 = ("No 'keys' should be provided when initializing floret vectors "
|
|
|
|
"with 'minn' and 'maxn'.")
|
|
|
|
E862 = ("'hash_count' must be between 1-4 for floret vectors.")
|
|
|
|
E863 = ("'maxn' must be greater than or equal to 'minn'.")
|
|
|
|
E864 = ("The complete vector table 'data' is required to initialize floret "
|
|
|
|
"vectors.")
|
2021-09-27 07:10:45 +00:00
|
|
|
E865 = ("A SpanGroup is not functional after the corresponding Doc has "
|
2021-08-20 09:06:19 +00:00
|
|
|
"been garbage collected. To keep using the spans, make sure that "
|
|
|
|
"the corresponding Doc object is still available in the scope of "
|
|
|
|
"your function.")
|
2021-09-22 07:41:05 +00:00
|
|
|
E866 = ("Expected a string or 'Doc' as input, but got: {type}.")
|
2021-07-06 10:35:22 +00:00
|
|
|
E867 = ("The 'textcat' component requires at least two labels because it "
|
|
|
|
"uses mutually exclusive classes where exactly one label is True "
|
|
|
|
"for each doc. For binary classification tasks, you can use two "
|
|
|
|
"labels with 'textcat' (LABEL / NOT_LABEL) or alternatively, you "
|
|
|
|
"can use the 'textcat_multilabel' component with one label.")
|
2021-06-17 07:33:00 +00:00
|
|
|
E868 = ("Found a conflicting gold annotation in a reference document, "
|
|
|
|
"with the following char-based span occurring both in the gold ents "
|
|
|
|
"as well as in the negative spans: {span}.")
|
|
|
|
E869 = ("The notation '{label}' is not supported anymore. To annotate "
|
|
|
|
"negative NER samples, use `doc.spans[key]` instead, and "
|
|
|
|
"specify the key as 'incorrect_spans_key' when constructing "
|
|
|
|
"the NER component.")
|
2021-05-17 13:48:40 +00:00
|
|
|
E870 = ("Could not serialize the DocBin because it is too large. Consider "
|
|
|
|
"splitting up your documents into several doc bins and serializing "
|
|
|
|
"each separately. spacy.Corpus.v1 will search recursively for all "
|
|
|
|
"*.spacy files if you provide a directory instead of a filename as "
|
|
|
|
"the 'path'.")
|
2021-05-17 11:28:39 +00:00
|
|
|
E871 = ("Error encountered in nlp.pipe with multiprocessing:\n\n{error}")
|
2021-04-22 10:36:50 +00:00
|
|
|
E872 = ("Unable to copy tokenizer from base model due to different "
|
|
|
|
'tokenizer settings: current tokenizer config "{curr_config}" '
|
|
|
|
'vs. base model "{base_config}"')
|
2021-03-29 11:34:01 +00:00
|
|
|
E873 = ("Unable to merge a span from doc.spans with key '{key}' and text "
|
|
|
|
"'{text}'. This is likely a bug in spaCy, so feel free to open an "
|
|
|
|
"issue: https://github.com/explosion/spaCy/issues")
|
2021-03-09 03:01:13 +00:00
|
|
|
E874 = ("Could not initialize the tok2vec model from component "
|
|
|
|
"'{component}' and layer '{layer}'.")
|
|
|
|
E875 = ("To use the PretrainVectors objective, make sure that static vectors are loaded. "
|
|
|
|
"In the config, these are defined by the initialize.vectors setting.")
|
2021-03-02 14:12:54 +00:00
|
|
|
E879 = ("Unexpected type for 'spans' data. Provide a dictionary mapping keys to "
|
|
|
|
"a list of spans, with each span represented by a tuple (start_char, end_char). "
|
|
|
|
"The tuple can be optionally extended with a label and a KB ID.")
|
2021-03-09 12:01:31 +00:00
|
|
|
E884 = ("The pipeline could not be initialized because the vectors "
|
|
|
|
"could not be found at '{vectors}'. If your pipeline was already "
|
|
|
|
"initialized/trained before, call 'resume_training' instead of 'initialize', "
|
|
|
|
"or initialize only the components that are new.")
|
2021-02-22 00:04:22 +00:00
|
|
|
E885 = ("entity_linker.set_kb received an invalid 'kb_loader' argument: expected "
|
|
|
|
"a callable function, but got: {arg_type}")
|
2021-01-29 05:27:49 +00:00
|
|
|
E886 = ("Can't replace {name} -> {tok2vec} listeners: path '{path}' not "
|
|
|
|
"found in config for component '{name}'.")
|
|
|
|
E887 = ("Can't replace {name} -> {tok2vec} listeners: the paths to replace "
|
|
|
|
"({paths}) don't match the available listeners in the model ({n_listeners}).")
|
|
|
|
E888 = ("Can't replace listeners for '{name}' ({pipe}): invalid upstream "
|
|
|
|
"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.")
|
2021-01-29 12:39:23 +00:00
|
|
|
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.")
|
2021-01-29 05:27:49 +00:00
|
|
|
E890 = ("Cannot add the alias '{alias}' to the Knowledge base. "
|
2021-01-29 00:51:40 +00:00
|
|
|
"Each alias should be a meaningful string.")
|
|
|
|
E891 = ("Alias '{alias}' could not be added to the Knowledge base. "
|
|
|
|
"This is likely a bug in spaCy.")
|
2021-01-18 00:43:39 +00:00
|
|
|
E892 = ("Unknown function registry: '{name}'.\n\nAvailable names: {available}")
|
2021-01-15 10:42:40 +00:00
|
|
|
E893 = ("Could not find function '{name}' in function registry '{reg_name}'. "
|
|
|
|
"If you're using a custom function, make sure the code is available. "
|
|
|
|
"If the function is provided by a third-party package, e.g. "
|
|
|
|
"spacy-transformers, make sure the package is installed in your "
|
|
|
|
"environment.\n\nAvailable names: {available}")
|
2021-01-17 11:56:05 +00:00
|
|
|
E894 = ("The 'noun_chunks' syntax iterator is not implemented for language "
|
|
|
|
"'{lang}'.")
|
2021-01-06 02:07:14 +00:00
|
|
|
E895 = ("The 'textcat' component received gold-standard annotations with "
|
|
|
|
"multiple labels per document. In spaCy 3 you should use the "
|
|
|
|
"'textcat_multilabel' component for this instead. "
|
|
|
|
"Example of an offending annotation: {value}")
|
2020-12-08 22:16:07 +00:00
|
|
|
E896 = ("There was an error using the static vectors. Ensure that the vectors "
|
|
|
|
"of the vocab are properly initialized, or set 'include_static_vectors' "
|
|
|
|
"to False.")
|
2020-10-18 12:50:41 +00:00
|
|
|
E897 = ("Field '{field}' should be a dot-notation string referring to the "
|
|
|
|
"relevant section in the config, but found type {type} instead.")
|
2020-10-10 16:55:07 +00:00
|
|
|
E898 = ("Can't serialize trainable pipe '{name}': the `model` attribute "
|
|
|
|
"is not set or None. If you've implemented a custom component, make "
|
|
|
|
"sure to store the component model as `self.model` in your "
|
|
|
|
"component's __init__ method.")
|
|
|
|
E899 = ("Can't serialize trainable pipe '{name}': the `vocab` attribute "
|
|
|
|
"is not set or None. If you've implemented a custom component, make "
|
|
|
|
"sure to store the current `nlp` object's vocab as `self.vocab` in "
|
|
|
|
"your component's __init__ method.")
|
2020-10-09 16:00:16 +00:00
|
|
|
E900 = ("Could not run the full pipeline for evaluation. If you specified "
|
|
|
|
"frozen components, make sure they were already initialized and "
|
|
|
|
"trained. Full pipeline: {pipeline}")
|
2020-10-05 18:11:16 +00:00
|
|
|
E901 = ("Failed to remove existing output directory: {path}. If your "
|
|
|
|
"config and the components you train change between runs, a "
|
|
|
|
"non-empty output directory can lead to stale pipeline data. To "
|
|
|
|
"solve this, remove the existing directories in the output directory.")
|
2020-10-05 11:43:32 +00:00
|
|
|
E902 = ("The sentence-per-line IOB/IOB2 file is not formatted correctly. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"Try checking whitespace and delimiters. See "
|
2021-01-30 09:09:38 +00:00
|
|
|
"https://spacy.io/api/cli#convert")
|
2020-10-05 11:43:32 +00:00
|
|
|
E903 = ("The token-per-line NER file is not formatted correctly. Try checking "
|
2021-01-30 09:09:38 +00:00
|
|
|
"whitespace and delimiters. See https://spacy.io/api/cli#convert")
|
2020-10-04 09:16:31 +00:00
|
|
|
E904 = ("Cannot initialize StaticVectors layer: nO dimension unset. This "
|
|
|
|
"dimension refers to the output width, after the linear projection "
|
|
|
|
"has been applied.")
|
|
|
|
E905 = ("Cannot initialize StaticVectors layer: nM dimension unset. This "
|
|
|
|
"dimension refers to the width of the vectors table.")
|
2020-12-08 06:41:03 +00:00
|
|
|
E906 = ("Unexpected `loss` value in pretraining objective: '{found}'. Supported values "
|
|
|
|
"are: {supported}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E908 = ("Can't set `spaces` without `words` in `Doc.__init__`.")
|
|
|
|
E909 = ("Expected {name} in parser internals. This is likely a bug in spaCy.")
|
|
|
|
E910 = ("Encountered NaN value when computing loss for component '{name}'.")
|
|
|
|
E911 = ("Invalid feature: {feat}. Must be a token attribute.")
|
2020-10-02 13:42:36 +00:00
|
|
|
E912 = ("Failed to initialize lemmatizer. Missing lemmatizer table(s) found "
|
|
|
|
"for mode '{mode}'. Required tables: {tables}. Found: {found}.")
|
2020-09-29 20:33:46 +00:00
|
|
|
E913 = ("Corpus path can't be None. Maybe you forgot to define it in your "
|
2022-01-04 13:31:26 +00:00
|
|
|
".cfg file or override it on the CLI?")
|
2020-09-24 10:40:25 +00:00
|
|
|
E914 = ("Executing {name} callback failed. Expected the function to "
|
2020-09-24 11:48:41 +00:00
|
|
|
"return the nlp object but got: {value}. Maybe you forgot to return "
|
2020-09-24 10:40:25 +00:00
|
|
|
"the modified object in your function?")
|
2020-09-24 09:29:07 +00:00
|
|
|
E915 = ("Can't use score '{name}' to calculate final weighted score. Expected "
|
|
|
|
"float or int but got: {score_type}. To exclude the score from the "
|
|
|
|
"final score, set its weight to null in the [training.score_weights] "
|
|
|
|
"section of your training config.")
|
2020-09-24 09:04:35 +00:00
|
|
|
E916 = ("Can't log score for '{name}' in table: not a valid score ({score_type})")
|
2020-10-04 09:16:31 +00:00
|
|
|
E917 = ("Received invalid value {value} for `state_type` in "
|
2020-09-23 14:57:14 +00:00
|
|
|
"TransitionBasedParser: only 'parser' or 'ner' are valid options.")
|
2020-09-15 11:25:34 +00:00
|
|
|
E918 = ("Received invalid value for vocab: {vocab} ({vocab_type}). Valid "
|
2020-10-04 09:16:31 +00:00
|
|
|
"values are an instance of `spacy.vocab.Vocab` or True to create one"
|
2020-09-15 11:25:34 +00:00
|
|
|
" (default).")
|
2020-10-04 09:16:31 +00:00
|
|
|
E919 = ("A textcat `positive_label` '{pos_label}' was provided for training "
|
2020-09-14 15:08:00 +00:00
|
|
|
"data that does not appear to be a binary classification problem "
|
|
|
|
"with two labels. Labels found: {labels}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E920 = ("The textcat's `positive_label` setting '{pos_label}' "
|
2020-10-03 15:07:38 +00:00
|
|
|
"does not match any label in the training data or provided during "
|
|
|
|
"initialization. Available labels: {labels}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E921 = ("The method `set_output` can only be called on components that have "
|
|
|
|
"a Model with a `resize_output` attribute. Otherwise, the output "
|
2020-09-08 20:44:25 +00:00
|
|
|
"layer can not be dynamically changed.")
|
|
|
|
E922 = ("Component '{name}' has been initialized with an output dimension of "
|
|
|
|
"{nO} - cannot add any more labels.")
|
|
|
|
E923 = ("It looks like there is no proper sample data to initialize the "
|
2021-02-08 08:21:36 +00:00
|
|
|
"Model of component '{name}'. To check your input data paths and "
|
2021-09-27 18:43:03 +00:00
|
|
|
"annotation, run: python -m spacy debug data config.cfg "
|
|
|
|
"and include the same config override values you would specify "
|
|
|
|
"for the 'spacy train' command.")
|
2020-09-08 20:44:25 +00:00
|
|
|
E924 = ("The '{name}' component does not seem to be initialized properly. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"This is likely a bug in spaCy, so feel free to open an issue: "
|
|
|
|
"https://github.com/explosion/spaCy/issues")
|
2020-09-03 21:05:41 +00:00
|
|
|
E925 = ("Invalid color values for displaCy visualizer: expected dictionary "
|
|
|
|
"mapping label names to colors but got: {obj}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E926 = ("It looks like you're trying to modify `nlp.{attr}` directly. This "
|
2020-08-29 13:20:11 +00:00
|
|
|
"doesn't work because it's an immutable computed property. If you "
|
|
|
|
"need to modify the pipeline, use the built-in methods like "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`nlp.add_pipe`, `nlp.remove_pipe`, `nlp.disable_pipe` or "
|
|
|
|
"`nlp.enable_pipe` instead.")
|
2022-09-15 15:29:42 +00:00
|
|
|
E927 = ("Can't write to frozen list. Maybe you're trying to modify a computed "
|
2020-08-29 13:20:11 +00:00
|
|
|
"property or default function argument?")
|
2022-09-08 08:38:07 +00:00
|
|
|
E928 = ("An InMemoryLookupKB can only be serialized to/from from a directory, "
|
2020-09-24 14:53:59 +00:00
|
|
|
"but the provided argument {loc} points to a file.")
|
2022-09-08 08:38:07 +00:00
|
|
|
E929 = ("Couldn't read InMemoryLookupKB from {loc}. The path does not seem to exist.")
|
2020-10-08 19:33:49 +00:00
|
|
|
E930 = ("Received invalid get_examples callback in `{method}`. "
|
2020-08-11 21:29:31 +00:00
|
|
|
"Expected function that returns an iterable of Example objects but "
|
|
|
|
"got: {obj}")
|
2020-10-08 19:33:49 +00:00
|
|
|
E931 = ("Encountered {parent} subclass without `{parent}.{method}` "
|
|
|
|
"method in component '{name}'. If you want to use this "
|
|
|
|
"method, make sure it's overwritten on the subclass.")
|
2020-08-11 21:29:31 +00:00
|
|
|
E940 = ("Found NaN values in scores.")
|
2020-08-05 21:10:29 +00:00
|
|
|
E941 = ("Can't find model '{name}'. It looks like you're trying to load a "
|
2021-04-12 12:37:00 +00:00
|
|
|
"model from a shortcut, which is obsolete as of spaCy v3.0. To "
|
2020-08-05 21:15:05 +00:00
|
|
|
"load the model, use its full name instead:\n\n"
|
2020-08-05 21:10:29 +00:00
|
|
|
"nlp = spacy.load(\"{full}\")\n\nFor more details on the available "
|
2020-08-05 21:15:05 +00:00
|
|
|
"models, see the models directory: https://spacy.io/models. If you "
|
|
|
|
"want to create a blank model, use spacy.blank: "
|
|
|
|
"nlp = spacy.blank(\"{name}\")")
|
2020-10-04 09:16:31 +00:00
|
|
|
E942 = ("Executing `after_{name}` callback failed. Expected the function to "
|
2020-08-05 17:47:54 +00:00
|
|
|
"return an initialized nlp object but got: {value}. Maybe "
|
|
|
|
"you forgot to return the modified object in your function?")
|
2020-10-04 09:16:31 +00:00
|
|
|
E943 = ("Executing `before_creation` callback failed. Expected the function to "
|
2020-08-05 17:47:54 +00:00
|
|
|
"return an uninitialized Language subclass but got: {value}. Maybe "
|
|
|
|
"you forgot to return the modified object in your function or "
|
|
|
|
"returned the initialized nlp object instead?")
|
2020-10-04 09:16:31 +00:00
|
|
|
E944 = ("Can't copy pipeline component '{name}' from source '{model}': "
|
2020-08-04 21:39:19 +00:00
|
|
|
"not found in pipeline. Available components: {opts}")
|
2021-04-19 08:36:32 +00:00
|
|
|
E945 = ("Can't copy pipeline component '{name}' from source. Expected "
|
|
|
|
"loaded nlp object, but got: {source}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E947 = ("`Matcher.add` received invalid `greedy` argument: expected "
|
2020-07-29 09:04:43 +00:00
|
|
|
"a string value from {expected} but got: '{arg}'")
|
2020-10-04 09:16:31 +00:00
|
|
|
E948 = ("`Matcher.add` received invalid 'patterns' argument: expected "
|
|
|
|
"a list, but got: {arg_type}")
|
2020-11-03 15:24:38 +00:00
|
|
|
E949 = ("Unable to align tokens for the predicted and reference docs. It "
|
|
|
|
"is only possible to align the docs when both texts are the same "
|
|
|
|
"except for whitespace and capitalization. The predicted tokens "
|
|
|
|
"start with: {x}. The reference tokens start with: {y}.")
|
2020-07-28 14:24:14 +00:00
|
|
|
E952 = ("The section '{name}' is not a valid section in the provided config.")
|
2020-07-25 13:01:15 +00:00
|
|
|
E953 = ("Mismatched IDs received by the Tok2Vec listener: {id1} vs. {id2}")
|
2020-09-18 14:43:15 +00:00
|
|
|
E954 = ("The Tok2Vec listener did not receive any valid input from an upstream "
|
|
|
|
"component.")
|
2020-10-02 13:42:36 +00:00
|
|
|
E955 = ("Can't find table(s) {table} for language '{lang}' in "
|
|
|
|
"spacy-lookups-data. Make sure you have the package installed or "
|
|
|
|
"provide your own lookup tables if no default lookups are available "
|
|
|
|
"for your language.")
|
2020-07-22 11:42:59 +00:00
|
|
|
E956 = ("Can't find component '{name}' in [components] block in the config. "
|
|
|
|
"Available components: {opts}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E957 = ("Writing directly to `Language.factories` isn't needed anymore in "
|
|
|
|
"spaCy v3. Instead, you can use the `@Language.factory` decorator "
|
|
|
|
"to register your custom component factory or `@Language.component` "
|
2020-07-22 11:42:59 +00:00
|
|
|
"to register a simple stateless function component that just takes "
|
|
|
|
"a Doc and returns it.")
|
|
|
|
E958 = ("Language code defined in config ({bad_lang_code}) does not match "
|
2020-09-15 12:24:06 +00:00
|
|
|
"language code of current Language subclass {lang} ({lang_code}). "
|
|
|
|
"If you want to create an nlp object from a config, make sure to "
|
|
|
|
"use the matching subclass with the language-specific settings and "
|
|
|
|
"data.")
|
2020-07-22 11:42:59 +00:00
|
|
|
E959 = ("Can't insert component {dir} index {idx}. Existing components: {opts}")
|
|
|
|
E960 = ("No config data found for component '{name}'. This is likely a bug "
|
|
|
|
"in spaCy.")
|
|
|
|
E961 = ("Found non-serializable Python object in config. Configs should "
|
|
|
|
"only include values that can be serialized to JSON. If you need "
|
|
|
|
"to pass models or other objects to your component, use a reference "
|
|
|
|
"to a registered function or initialize the object in your "
|
|
|
|
"component.\n\n{config}")
|
|
|
|
E962 = ("Received incorrect {style} for pipe '{name}'. Expected dict, "
|
|
|
|
"got: {cfg_type}.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E963 = ("Can't read component info from `@Language.{decorator}` decorator. "
|
2020-07-22 11:42:59 +00:00
|
|
|
"Maybe you forgot to call it? Make sure you're using "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`@Language.{decorator}()` instead of `@Language.{decorator}`.")
|
2020-07-22 11:42:59 +00:00
|
|
|
E964 = ("The pipeline component factory for '{name}' needs to have the "
|
|
|
|
"following named arguments, which are passed in by spaCy:\n- nlp: "
|
|
|
|
"receives the current nlp object and lets you access the vocab\n- "
|
|
|
|
"name: the name of the component instance, can be used to identify "
|
|
|
|
"the component, output losses etc.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E965 = ("It looks like you're using the `@Language.component` decorator to "
|
2020-07-22 11:42:59 +00:00
|
|
|
"register '{name}' on a class instead of a function component. If "
|
|
|
|
"you need to register a class or function that *returns* a component "
|
2020-10-04 09:16:31 +00:00
|
|
|
"function, use the `@Language.factory` decorator instead.")
|
|
|
|
E966 = ("`nlp.add_pipe` now takes the string name of the registered component "
|
2020-07-22 11:42:59 +00:00
|
|
|
"factory, not a callable component. Expected string, but got "
|
|
|
|
"{component} (name: '{name}').\n\n- If you created your component "
|
2020-10-04 09:16:31 +00:00
|
|
|
"with `nlp.create_pipe('name')`: remove nlp.create_pipe and call "
|
|
|
|
"`nlp.add_pipe('name')` instead.\n\n- If you passed in a component "
|
|
|
|
"like `TextCategorizer()`: call `nlp.add_pipe` with the string name "
|
|
|
|
"instead, e.g. `nlp.add_pipe('textcat')`.\n\n- If you're using a custom "
|
|
|
|
"component: Add the decorator `@Language.component` (for function "
|
|
|
|
"components) or `@Language.factory` (for class components / factories) "
|
2020-07-22 11:42:59 +00:00
|
|
|
"to your custom component and assign it a name, e.g. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`@Language.component('your_name')`. You can then run "
|
|
|
|
"`nlp.add_pipe('your_name')` to add it to the pipeline.")
|
2020-07-22 11:42:59 +00:00
|
|
|
E967 = ("No {meta} meta information found for '{name}'. This is likely a bug in spaCy.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E968 = ("`nlp.replace_pipe` now takes the string name of the registered component "
|
2020-07-22 11:42:59 +00:00
|
|
|
"factory, not a callable component. Expected string, but got "
|
|
|
|
"{component}.\n\n- If you created your component with"
|
2020-10-04 09:16:31 +00:00
|
|
|
"with `nlp.create_pipe('name')`: remove `nlp.create_pipe` and call "
|
|
|
|
"`nlp.replace_pipe('{name}', 'name')` instead.\n\n- If you passed in a "
|
|
|
|
"component like `TextCategorizer()`: call `nlp.replace_pipe` with the "
|
|
|
|
"string name instead, e.g. `nlp.replace_pipe('{name}', 'textcat')`.\n\n"
|
2020-07-22 11:42:59 +00:00
|
|
|
"- If you're using a custom component: Add the decorator "
|
2020-10-04 09:16:31 +00:00
|
|
|
"`@Language.component` (for function components) or `@Language.factory` "
|
2020-07-22 11:42:59 +00:00
|
|
|
"(for class components / factories) to your custom component and "
|
2020-10-04 09:16:31 +00:00
|
|
|
"assign it a name, e.g. `@Language.component('your_name')`. You can "
|
|
|
|
"then run `nlp.replace_pipe('{name}', 'your_name')`.")
|
2020-07-07 16:46:00 +00:00
|
|
|
E969 = ("Expected string values for field '{field}', but received {types} instead. ")
|
2020-06-30 15:28:43 +00:00
|
|
|
E970 = ("Can not execute command '{str_command}'. Do you have '{tool}' installed?")
|
2020-10-04 09:16:31 +00:00
|
|
|
E971 = ("Found incompatible lengths in `Doc.from_array`: {array_length} for the "
|
2020-06-29 12:33:00 +00:00
|
|
|
"array and {doc_length} for the Doc itself.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E972 = ("`Example.__init__` got None for '{arg}'. Requires Doc.")
|
2020-06-29 12:33:00 +00:00
|
|
|
E973 = ("Unexpected type for NER data")
|
|
|
|
E974 = ("Unknown {obj} attribute: {key}")
|
2020-10-04 09:16:31 +00:00
|
|
|
E976 = ("The method `Example.from_dict` expects a {type} as {n} argument, "
|
2020-06-29 12:33:00 +00:00
|
|
|
"but received None.")
|
|
|
|
E977 = ("Can not compare a MorphAnalysis with a string object. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"This is likely a bug in spaCy, so feel free to open an issue: "
|
|
|
|
"https://github.com/explosion/spaCy/issues")
|
2020-08-11 21:29:31 +00:00
|
|
|
E978 = ("The {name} method takes a list of Example objects, but got: {types}")
|
2020-06-26 17:34:12 +00:00
|
|
|
E980 = ("Each link annotation should refer to a dictionary with at most one "
|
|
|
|
"identifier mapping to 1.0, and all others to 0.0.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E981 = ("The offsets of the annotations for `links` could not be aligned "
|
2020-07-02 11:57:35 +00:00
|
|
|
"to token boundaries.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E982 = ("The `Token.ent_iob` attribute should be an integer indexing "
|
2020-06-26 17:34:12 +00:00
|
|
|
"into {values}, but found {value}.")
|
2021-09-27 18:43:03 +00:00
|
|
|
E983 = ("Invalid key(s) for '{dict}': {key}. Available keys: "
|
2020-06-12 00:02:07 +00:00
|
|
|
"{keys}")
|
2020-08-04 21:39:19 +00:00
|
|
|
E984 = ("Invalid component config for '{name}': component block needs either "
|
2020-10-04 09:16:31 +00:00
|
|
|
"a key `factory` specifying the registered function used to "
|
|
|
|
"initialize the component, or a key `source` key specifying a "
|
|
|
|
"spaCy model to copy the component from. For example, `factory = "
|
|
|
|
"\"ner\"` will use the 'ner' factory and all other settings in the "
|
|
|
|
"block will be passed to it as arguments. Alternatively, `source = "
|
|
|
|
"\"en_core_web_sm\"` will copy the component from that model.\n\n{config}")
|
|
|
|
E985 = ("Can't load model from config file: no [nlp] section found.\n\n{config}")
|
2020-06-03 08:00:21 +00:00
|
|
|
E986 = ("Could not create any training batches: check your input. "
|
2020-10-04 09:16:31 +00:00
|
|
|
"Are the train and dev paths defined? Is `discard_oversize` set appropriately? ")
|
|
|
|
E989 = ("`nlp.update()` was called with two positional arguments. This "
|
2020-05-20 09:41:12 +00:00
|
|
|
"may be due to a backwards-incompatible change to the format "
|
|
|
|
"of the training data in spaCy 3.0 onwards. The 'update' "
|
2020-10-04 09:16:31 +00:00
|
|
|
"function should now be called with a batch of Example "
|
|
|
|
"objects, instead of `(text, annotation)` tuples. ")
|
|
|
|
E991 = ("The function `nlp.select_pipes` should be called with either a "
|
|
|
|
"`disable` argument to list the names of the pipe components "
|
2020-05-18 20:27:10 +00:00
|
|
|
"that should be disabled, or with an 'enable' argument that "
|
|
|
|
"specifies which pipes should not be disabled.")
|
|
|
|
E992 = ("The function `select_pipes` was called with `enable`={enable} "
|
|
|
|
"and `disable`={disable} but that information is conflicting "
|
|
|
|
"for the `nlp` pipeline with components {names}.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E993 = ("The config for the nlp object needs to include a key `lang` specifying "
|
2020-07-22 11:42:59 +00:00
|
|
|
"the code of the language to initialize it with (for example "
|
2020-10-04 09:16:31 +00:00
|
|
|
"'en' for English) - this can't be None.\n\n{config}")
|
2019-12-21 17:55:03 +00:00
|
|
|
E997 = ("Tokenizer special cases are not allowed to modify the text. "
|
Generalize handling of tokenizer special cases (#4259)
* Generalize handling of tokenizer special cases
Handle tokenizer special cases more generally by using the Matcher
internally to match special cases after the affix/token_match
tokenization is complete.
Instead of only matching special cases while processing balanced or
nearly balanced prefixes and suffixes, this recognizes special cases in
a wider range of contexts:
* Allows arbitrary numbers of prefixes/affixes around special cases
* Allows special cases separated by infixes
Existing tests/settings that couldn't be preserved as before:
* The emoticon '")' is no longer a supported special case
* The emoticon ':)' in "example:)" is a false positive again
When merged with #4258 (or the relevant cache bugfix), the affix and
token_match properties should be modified to flush and reload all
special cases to use the updated internal tokenization with the Matcher.
* Remove accidentally added test case
* Really remove accidentally added test
* Reload special cases when necessary
Reload special cases when affixes or token_match are modified. Skip
reloading during initialization.
* Update error code number
* Fix offset and whitespace in Matcher special cases
* Fix offset bugs when merging and splitting tokens
* Set final whitespace on final token in inserted special case
* Improve cache flushing in tokenizer
* Separate cache and specials memory (temporarily)
* Flush cache when adding special cases
* Repeated `self._cache = PreshMap()` and `self._specials = PreshMap()`
are necessary due to this bug:
https://github.com/explosion/preshed/issues/21
* Remove reinitialized PreshMaps on cache flush
* Update UD bin scripts
* Update imports for `bin/`
* Add all currently supported languages
* Update subtok merger for new Matcher validation
* Modify blinded check to look at tokens instead of lemmas (for corpora
with tokens but not lemmas like Telugu)
* Use special Matcher only for cases with affixes
* Reinsert specials cache checks during normal tokenization for special
cases as much as possible
* Additionally include specials cache checks while splitting on infixes
* Since the special Matcher needs consistent affix-only tokenization
for the special cases themselves, introduce the argument
`with_special_cases` in order to do tokenization with or without
specials cache checks
* After normal tokenization, postprocess with special cases Matcher for
special cases containing affixes
* Replace PhraseMatcher with Aho-Corasick
Replace PhraseMatcher with the Aho-Corasick algorithm over numpy arrays
of the hash values for the relevant attribute. The implementation is
based on FlashText.
The speed should be similar to the previous PhraseMatcher. It is now
possible to easily remove match IDs and matches don't go missing with
large keyword lists / vocabularies.
Fixes #4308.
* Restore support for pickling
* Fix internal keyword add/remove for numpy arrays
* Add test for #4248, clean up test
* Improve efficiency of special cases handling
* Use PhraseMatcher instead of Matcher
* Improve efficiency of merging/splitting special cases in document
* Process merge/splits in one pass without repeated token shifting
* Merge in place if no splits
* Update error message number
* Remove UD script modifications
Only used for timing/testing, should be a separate PR
* Remove final traces of UD script modifications
* Update UD bin scripts
* Update imports for `bin/`
* Add all currently supported languages
* Update subtok merger for new Matcher validation
* Modify blinded check to look at tokens instead of lemmas (for corpora
with tokens but not lemmas like Telugu)
* Add missing loop for match ID set in search loop
* Remove cruft in matching loop for partial matches
There was a bit of unnecessary code left over from FlashText in the
matching loop to handle partial token matches, which we don't have with
PhraseMatcher.
* Replace dict trie with MapStruct trie
* Fix how match ID hash is stored/added
* Update fix for match ID vocab
* Switch from map_get_unless_missing to map_get
* Switch from numpy array to Token.get_struct_attr
Access token attributes directly in Doc instead of making a copy of the
relevant values in a numpy array.
Add unsatisfactory warning for hash collision with reserved terminal
hash key. (Ideally it would change the reserved terminal hash and redo
the whole trie, but for now, I'm hoping there won't be collisions.)
* Restructure imports to export find_matches
* Implement full remove()
Remove unnecessary trie paths and free unused maps.
Parallel to Matcher, raise KeyError when attempting to remove a match ID
that has not been added.
* Switch to PhraseMatcher.find_matches
* Switch to local cdef functions for span filtering
* Switch special case reload threshold to variable
Refer to variable instead of hard-coded threshold
* Move more of special case retokenize to cdef nogil
Move as much of the special case retokenization to nogil as possible.
* Rewrap sort as stdsort for OS X
* Rewrap stdsort with specific types
* Switch to qsort
* Fix merge
* Improve cmp functions
* Fix realloc
* Fix realloc again
* Initialize span struct while retokenizing
* Temporarily skip retokenizing
* Revert "Move more of special case retokenize to cdef nogil"
This reverts commit 0b7e52c797cd8ff1548f214bd4186ebb3a7ce8b1.
* Revert "Switch to qsort"
This reverts commit a98d71a942fc9bca531cf5eb05cf89fa88153b60.
* Fix specials check while caching
* Modify URL test with emoticons
The multiple suffix tests result in the emoticon `:>`, which is now
retokenized into one token as a special case after the suffixes are
split off.
* Refactor _apply_special_cases()
* Use cdef ints for span info used in multiple spots
* Modify _filter_special_spans() to prefer earlier
Parallel to #4414, modify _filter_special_spans() so that the earlier
span is preferred for overlapping spans of the same length.
* Replace MatchStruct with Entity
Replace MatchStruct with Entity since the existing Entity struct is
nearly identical.
* Replace Entity with more general SpanC
* Replace MatchStruct with SpanC
* Add error in debug-data if no dev docs are available (see #4575)
* Update azure-pipelines.yml
* Revert "Update azure-pipelines.yml"
This reverts commit ed1060cf59e5895b5fe92ad5b894fd1078ec4c49.
* Use latest wasabi
* Reorganise install_requires
* add dframcy to universe.json (#4580)
* Update universe.json [ci skip]
* Fix multiprocessing for as_tuples=True (#4582)
* Fix conllu script (#4579)
* force extensions to avoid clash between example scripts
* fix arg order and default file encoding
* add example config for conllu script
* newline
* move extension definitions to main function
* few more encodings fixes
* Add load_from_docbin example [ci skip]
TODO: upload the file somewhere
* Update README.md
* Add warnings about 3.8 (resolves #4593) [ci skip]
* Fixed typo: Added space between "recognize" and "various" (#4600)
* Fix DocBin.merge() example (#4599)
* Replace function registries with catalogue (#4584)
* Replace functions registries with catalogue
* Update __init__.py
* Fix test
* Revert unrelated flag [ci skip]
* Bugfix/dep matcher issue 4590 (#4601)
* add contributor agreement for prilopes
* add test for issue #4590
* fix on_match params for DependencyMacther (#4590)
* Minor updates to language example sentences (#4608)
* Add punctuation to Spanish example sentences
* Combine multilanguage examples for lang xx
* Add punctuation to nb examples
* Always realloc to a larger size
Avoid potential (unlikely) edge case and cymem error seen in #4604.
* Add error in debug-data if no dev docs are available (see #4575)
* Update debug-data for GoldCorpus / Example
* Ignore None label in misaligned NER data
2019-11-13 20:24:35 +00:00
|
|
|
"This would map '{chunk}' to '{orth}' given token attributes "
|
|
|
|
"'{token_attrs}'.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E999 = ("Unable to merge the Doc objects because they do not all share "
|
2020-07-03 09:32:42 +00:00
|
|
|
"the same `Vocab`.")
|
2020-09-27 12:00:18 +00:00
|
|
|
E1000 = ("The Chinese word segmenter is pkuseg but no pkuseg model was "
|
2020-09-30 09:46:45 +00:00
|
|
|
"loaded. Provide the name of a pretrained model or the path to "
|
|
|
|
"a model and initialize the pipeline:\n\n"
|
2020-09-30 21:48:47 +00:00
|
|
|
'nlp.tokenizer.initialize(pkuseg_model="default")')
|
2020-08-04 15:02:39 +00:00
|
|
|
E1001 = ("Target token outside of matched span for match with tokens "
|
|
|
|
"'{span}' and offset '{index}' matched by patterns '{patterns}'.")
|
|
|
|
E1002 = ("Span index out of range.")
|
2020-08-07 13:27:13 +00:00
|
|
|
E1003 = ("Unsupported lemmatizer mode '{mode}'.")
|
|
|
|
E1004 = ("Missing lemmatizer table(s) found for lemmatizer mode '{mode}'. "
|
2020-10-02 13:42:36 +00:00
|
|
|
"Required tables: {tables}. Found: {found}. Maybe you forgot to "
|
2020-10-04 09:16:31 +00:00
|
|
|
"call `nlp.initialize()` to load in the data?")
|
2020-08-31 07:42:06 +00:00
|
|
|
E1005 = ("Unable to set attribute '{attr}' in tokenizer exception for "
|
|
|
|
"'{chunk}'. Tokenizer exceptions are only allowed to specify "
|
2020-10-04 09:16:31 +00:00
|
|
|
"ORTH and NORM.")
|
2020-08-31 18:04:26 +00:00
|
|
|
E1007 = ("Unsupported DependencyMatcher operator '{op}'.")
|
|
|
|
E1008 = ("Invalid pattern: each pattern should be a list of dicts. Check "
|
|
|
|
"that you are providing a list of patterns as `List[List[dict]]`.")
|
2020-09-21 13:54:05 +00:00
|
|
|
E1010 = ("Unable to set entity information for token {i} which is included "
|
|
|
|
"in more than one span in entities, blocked, missing or outside.")
|
2020-10-04 09:16:31 +00:00
|
|
|
E1011 = ("Unsupported default '{default}' in `doc.set_ents`. Available "
|
2020-09-21 13:54:05 +00:00
|
|
|
"options: {modes}")
|
2020-09-22 12:42:51 +00:00
|
|
|
E1012 = ("Entity spans and blocked/missing/outside spans should be "
|
2020-10-04 09:16:31 +00:00
|
|
|
"provided to `doc.set_ents` as lists of Span objects.")
|
2020-10-01 20:21:46 +00:00
|
|
|
E1013 = ("Invalid morph: the MorphAnalysis must have the same vocab as the "
|
|
|
|
"token itself. To set the morph from this MorphAnalysis, set from "
|
|
|
|
"the string value with: `token.set_morph(str(other_morph))`.")
|
2020-11-27 06:39:49 +00:00
|
|
|
E1014 = ("Error loading DocBin data. It doesn't look like the data is in "
|
|
|
|
"DocBin (.spacy) format. If your data is in spaCy v2's JSON "
|
|
|
|
"training format, convert it using `python -m spacy convert "
|
|
|
|
"file.json .`.")
|
2021-01-14 15:57:57 +00:00
|
|
|
E1015 = ("Can't initialize model from config: no {value} found. For more "
|
|
|
|
"information, run: python -m spacy debug config config.cfg")
|
2021-01-29 00:52:01 +00:00
|
|
|
E1016 = ("The operators 'OP': '?', '*', and '+' are not supported in "
|
|
|
|
"DependencyMatcher token patterns. The token pattern in "
|
|
|
|
"RIGHT_ATTR should return matches that are each exactly one token "
|
|
|
|
"long. Invalid pattern:\n{node}")
|
2021-06-15 11:23:32 +00:00
|
|
|
E1017 = ("A Doc object requires both 'deps' and 'heads' for dependency "
|
|
|
|
"parses. If no dependency labels are available, provide "
|
|
|
|
"placeholder deps such as `deps=[\"dep\"]*len(heads)`.")
|
2021-06-25 21:04:00 +00:00
|
|
|
E1018 = ("Knowledge base for component '{name}' is not set. "
|
|
|
|
"Make sure either `nel.initialize` or `nel.set_kb` "
|
|
|
|
"is called with a `kb_loader` function.")
|
2021-07-14 12:01:02 +00:00
|
|
|
E1019 = ("`noun_chunks` requires the pos tagging, which requires a "
|
|
|
|
"statistical model to be installed and loaded. For more info, see "
|
|
|
|
"the documentation:\nhttps://spacy.io/usage/models")
|
2021-09-01 05:17:42 +00:00
|
|
|
E1020 = ("No `epoch_resume` value specified and could not infer one from "
|
|
|
|
"filename. Specify an epoch to resume from.")
|
2021-09-16 11:28:05 +00:00
|
|
|
E1021 = ("`pos` value \"{pp}\" is not a valid Universal Dependencies tag. "
|
|
|
|
"Non-UD tags should use the `tag` property.")
|
2021-10-29 10:08:40 +00:00
|
|
|
E1022 = ("Words must be of type str or int, but input is of type '{wtype}'")
|
2022-01-20 12:19:38 +00:00
|
|
|
E1023 = ("Couldn't read EntityRuler from the {path}. This file doesn't "
|
|
|
|
"exist.")
|
2022-06-02 11:12:53 +00:00
|
|
|
E1024 = ("A pattern with {attr_type} '{label}' is not present in "
|
|
|
|
"'{component}' patterns.")
|
2022-01-20 12:19:38 +00:00
|
|
|
E1025 = ("Cannot intify the value '{value}' as an IOB string. The only "
|
|
|
|
"supported values are: 'I', 'O', 'B' and ''")
|
2022-03-28 09:13:50 +00:00
|
|
|
E1026 = ("Edit tree has an invalid format:\n{errors}")
|
2022-04-01 07:02:06 +00:00
|
|
|
E1027 = ("AlignmentArray only supports slicing with a step of 1.")
|
|
|
|
E1028 = ("AlignmentArray only supports indexing using an int or a slice.")
|
2022-05-02 11:38:46 +00:00
|
|
|
E1029 = ("Edit tree cannot be applied to form.")
|
|
|
|
E1030 = ("Edit tree identifier out of range.")
|
|
|
|
E1031 = ("Could not find gold transition - see logs above.")
|
|
|
|
E1032 = ("`{var}` should not be {forbidden}, but received {value}.")
|
|
|
|
E1033 = ("Dimension {name} invalid -- only nO, nF, nP")
|
|
|
|
E1034 = ("Node index {i} out of bounds ({length})")
|
|
|
|
E1035 = ("Token index {i} out of bounds ({length})")
|
|
|
|
E1036 = ("Cannot index into NoneNode")
|
2022-05-25 09:12:29 +00:00
|
|
|
E1037 = ("Invalid attribute value '{attr}'.")
|
2022-06-02 12:03:47 +00:00
|
|
|
E1038 = ("Invalid JSON input: {message}")
|
|
|
|
E1039 = ("The {obj} start or end annotations (start: {start}, end: {end}) "
|
|
|
|
"could not be aligned to token boundaries.")
|
|
|
|
E1040 = ("Doc.from_json requires all tokens to have the same attributes. "
|
|
|
|
"Some tokens do not contain annotation for: {partial_attrs}")
|
2022-06-02 18:06:49 +00:00
|
|
|
E1041 = ("Expected a string, Doc, or bytes as input, but got: {type}")
|
2022-09-27 12:22:36 +00:00
|
|
|
E1042 = ("`enable={enable}` and `disable={disable}` are inconsistent with each other.\nIf you only passed "
|
|
|
|
"one of `enable` or `disable`, the other argument is specified in your pipeline's configuration.\nIn that "
|
|
|
|
"case pass an empty list for the previously not specified argument to avoid this error.")
|
2022-07-04 15:05:21 +00:00
|
|
|
E1043 = ("Expected None or a value in range [{range_start}, {range_end}] for entity linker threshold, but got "
|
|
|
|
"{value}.")
|
2022-09-08 08:38:07 +00:00
|
|
|
E1044 = ("Expected `candidates_batch_size` to be >= 1, but got: {value}")
|
|
|
|
E1045 = ("Encountered {parent} subclass without `{parent}.{method}` "
|
|
|
|
"method in '{name}'. If you want to use this method, make "
|
|
|
|
"sure it's overwritten on the subclass.")
|
|
|
|
E1046 = ("{cls_name} is an abstract class and cannot be instantiated. If you are looking for spaCy's default "
|
|
|
|
"knowledge base, use `InMemoryLookupKB`.")
|
2022-05-02 11:38:46 +00:00
|
|
|
|
2020-07-03 09:32:42 +00:00
|
|
|
|
2020-08-05 21:10:29 +00:00
|
|
|
# Deprecated model shortcuts, only used in errors and warnings
|
|
|
|
OLD_MODEL_SHORTCUTS = {
|
|
|
|
"en": "en_core_web_sm", "de": "de_core_news_sm", "es": "es_core_news_sm",
|
|
|
|
"pt": "pt_core_news_sm", "fr": "fr_core_news_sm", "it": "it_core_news_sm",
|
|
|
|
"nl": "nl_core_news_sm", "el": "el_core_news_sm", "nb": "nb_core_news_sm",
|
|
|
|
"lt": "lt_core_news_sm", "xx": "xx_ent_wiki_sm"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
# fmt: on
|
|
|
|
|
|
|
|
|
2019-02-12 14:47:26 +00:00
|
|
|
class MatchPatternError(ValueError):
|
|
|
|
def __init__(self, key, errors):
|
|
|
|
"""Custom error for validating match patterns.
|
|
|
|
|
2020-05-24 15:20:58 +00:00
|
|
|
key (str): The name of the matcher rule.
|
2019-02-12 14:47:26 +00:00
|
|
|
errors (dict): Validation errors (sequence of strings) mapped to pattern
|
|
|
|
ID, i.e. the index of the added pattern.
|
|
|
|
"""
|
2019-12-22 00:53:56 +00:00
|
|
|
msg = f"Invalid token patterns for matcher rule '{key}'\n"
|
2019-02-12 14:47:26 +00:00
|
|
|
for pattern_idx, error_msgs in errors.items():
|
2019-12-22 00:53:56 +00:00
|
|
|
pattern_errors = "\n".join([f"- {e}" for e in error_msgs])
|
|
|
|
msg += f"\nPattern {pattern_idx}:\n{pattern_errors}\n"
|
2019-02-12 14:47:26 +00:00
|
|
|
ValueError.__init__(self, msg)
|