mirror of https://github.com/explosion/spaCy.git
proper error for missing cfg arguments
This commit is contained in:
parent
6026958957
commit
6e809e9b8b
|
@ -663,11 +663,10 @@ def build_simple_cnn_text_classifier(tok2vec, nr_class, exclusive_classes=False,
|
||||||
|
|
||||||
|
|
||||||
def build_nel_encoder(embed_width, hidden_width, ner_types, **cfg):
|
def build_nel_encoder(embed_width, hidden_width, ner_types, **cfg):
|
||||||
# TODO proper error
|
|
||||||
if "entity_width" not in cfg:
|
if "entity_width" not in cfg:
|
||||||
raise ValueError("entity_width not found")
|
raise ValueError(Errors.E144.format(param="entity_width"))
|
||||||
if "context_width" not in cfg:
|
if "context_width" not in cfg:
|
||||||
raise ValueError("context_width not found")
|
raise ValueError(Errors.E144.format(param="context_width"))
|
||||||
|
|
||||||
conv_depth = cfg.get("conv_depth", 2)
|
conv_depth = cfg.get("conv_depth", 2)
|
||||||
cnn_maxout_pieces = cfg.get("cnn_maxout_pieces", 3)
|
cnn_maxout_pieces = cfg.get("cnn_maxout_pieces", 3)
|
||||||
|
|
|
@ -406,6 +406,7 @@ class Errors(object):
|
||||||
E141 = ("Entity vectors should be of length {required} instead of the provided {found}.")
|
E141 = ("Entity vectors should be of length {required} instead of the provided {found}.")
|
||||||
E142 = ("Unsupported loss_function '{loss_func}'. Use either 'L2' or 'cosine'")
|
E142 = ("Unsupported loss_function '{loss_func}'. Use either 'L2' or 'cosine'")
|
||||||
E143 = ("Labels for component '{name}' not initialized. Did you forget to call add_label()?")
|
E143 = ("Labels for component '{name}' not initialized. Did you forget to call add_label()?")
|
||||||
|
E144 = ("Could not find parameter `{param}` when building the entity linker model.")
|
||||||
|
|
||||||
|
|
||||||
@add_codes
|
@add_codes
|
||||||
|
|
Loading…
Reference in New Issue