Support custom language factory setting in meta.json (#4031)

This commit is contained in:
Ines Montani 2019-07-27 13:17:43 +02:00 committed by GitHub
parent b7cd58c736
commit 307ffe472d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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", [])