mirror of https://github.com/explosion/spaCy.git
Fix resolve_dot_names
This commit is contained in:
parent
822ea4ef61
commit
02838a1d47
|
@ -379,9 +379,7 @@ def load_model_from_config(
|
||||||
return nlp
|
return nlp
|
||||||
|
|
||||||
|
|
||||||
def resolve_dot_names(
|
def resolve_dot_names(config: Config, dot_names: List[Optional[str]]) -> Tuple[Any]:
|
||||||
config: Config, dot_names: List[Optional[str]]
|
|
||||||
) -> Tuple[Any]:
|
|
||||||
"""Resolve one or more "dot notation" names, e.g. corpora.train.
|
"""Resolve one or more "dot notation" names, e.g. corpora.train.
|
||||||
The paths could point anywhere into the config, so we don't know which
|
The paths could point anywhere into the config, so we don't know which
|
||||||
top-level section we'll be looking within.
|
top-level section we'll be looking within.
|
||||||
|
@ -410,8 +408,7 @@ def resolve_dot_names(
|
||||||
objects = []
|
objects = []
|
||||||
for ref in output:
|
for ref in output:
|
||||||
if not isinstance(ref, str):
|
if not isinstance(ref, str):
|
||||||
msg = f"not a valid section reference: {ref} ({type(ref)})"
|
objects.append(ref)
|
||||||
errors.append({"loc": ref.split("."), "msg": msg})
|
|
||||||
continue
|
continue
|
||||||
section = ref.split(".")[0]
|
section = ref.split(".")[0]
|
||||||
# We want to avoid resolving the same thing twice
|
# We want to avoid resolving the same thing twice
|
||||||
|
|
Loading…
Reference in New Issue