From 100d66a052bb9fcda94fc7088f8112e19375ccac Mon Sep 17 00:00:00 2001 From: richardpaulhudson Date: Fri, 21 Oct 2022 12:48:03 +0200 Subject: [PATCH] Fix error codes --- spacy/errors.py | 3 +-- spacy/ml/models/tok2vec.py | 16 +++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/spacy/errors.py b/spacy/errors.py index 643d902b9..9a30f5e69 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -952,8 +952,7 @@ class Errors(metaclass=ErrorsWithCodes): "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`.") - E1047 = ("Search characters for '{label}' may not contain upper-case chars where case_sensitive==False.") - E1048 = ("Invalid rich group config '{label}'.") + E1047 = ("Invalid rich group config '{label}'.") # Deprecated model shortcuts, only used in errors and warnings diff --git a/spacy/ml/models/tok2vec.py b/spacy/ml/models/tok2vec.py index 2d72a417f..e552d04f2 100644 --- a/spacy/ml/models/tok2vec.py +++ b/spacy/ml/models/tok2vec.py @@ -198,21 +198,15 @@ def _verify_rich_config_group( ) -> None: if lengths is not None or rows is not None: if is_search_char_group and (search_chars is None or len(search_chars) == 0): - raise ValueError(Errors.E1045.format(label=label)) + raise ValueError(Errors.E1047.format(label=label)) if lengths is None or rows is None: - raise ValueError(Errors.E1045.format(label=label)) + raise ValueError(Errors.E1047.format(label=label)) if len(lengths) != len(rows): - raise ValueError(Errors.E1045.format(label=label)) + raise ValueError(Errors.E1047.format(label=label)) if any([length < 1 for length in lengths]): - raise ValueError(Errors.E1045.format(label=label)) - if ( - not case_sensitive - and search_chars is not None - and search_chars != search_chars.lower() - ): - raise ValueError(Errors.E1044.format(label=label)) + raise ValueError(Errors.E1047.format(label=label)) elif search_chars is not None: - raise ValueError(Errors.E1045.format(label=label)) + raise ValueError(Errors.E1047.format(label=label)) @registry.architectures("spacy.RichMultiHashEmbed.v1")