diff --git a/spacy/__init__.py b/spacy/__init__.py index 5e6d6cd18..dd8af47ac 100644 --- a/spacy/__init__.py +++ b/spacy/__init__.py @@ -10,8 +10,7 @@ from . import util def load(name, **overrides): - if overrides.get('path') not in (None, False, True): - name = overrides.get('path') + name = util.resolve_load_name(name, **overrides) model_path = util.resolve_model_path(name) meta = util.parse_package_meta(model_path) if 'lang' not in meta: diff --git a/spacy/util.py b/spacy/util.py index e5c7773f7..bc17e6a91 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -142,6 +142,15 @@ def read_json(location): return ujson.load(f) +def resolve_load_name(name, **overrides): + if overrides.get('path') not in (None, False, True): + name = overrides.get('path') + prints("To load a model from a path, you can now use the first argument.", + "OLD: spacy.load('en', path='/some/path')", "NEW: spacy.load('/some/path')", + title="Warning: deprecated argument 'path'") + return name + + def resolve_model_path(name): data_path = get_data_path() if not data_path or not data_path.exists():