Fix error codes

This commit is contained in:
richardpaulhudson 2022-10-21 12:48:03 +02:00
parent 34e8bc620d
commit 100d66a052
2 changed files with 6 additions and 13 deletions

View File

@ -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

View File

@ -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")