mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Support custom language factory setting in meta.json (#4031)
This commit is contained in:
parent
b7cd58c736
commit
307ffe472d
|
@ -160,7 +160,10 @@ def load_model_from_path(model_path, meta=False, **overrides):
|
||||||
pipeline from meta.json and then calls from_disk() with path."""
|
pipeline from meta.json and then calls from_disk() with path."""
|
||||||
if not meta:
|
if not meta:
|
||||||
meta = get_model_meta(model_path)
|
meta = get_model_meta(model_path)
|
||||||
cls = get_lang_class(meta["lang"])
|
# Support language factories registered via entry points (e.g. custom
|
||||||
|
# language subclass) while keeping top-level language identifier "lang"
|
||||||
|
lang = meta.get("lang_factory", meta["lang"])
|
||||||
|
cls = get_lang_class(lang)
|
||||||
nlp = cls(meta=meta, **overrides)
|
nlp = cls(meta=meta, **overrides)
|
||||||
pipeline = meta.get("pipeline", [])
|
pipeline = meta.get("pipeline", [])
|
||||||
disable = overrides.get("disable", [])
|
disable = overrides.get("disable", [])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user