diff --git a/spacy/__init__.py b/spacy/__init__.py index 6723c2be4..344fc427e 100644 --- a/spacy/__init__.py +++ b/spacy/__init__.py @@ -6,11 +6,12 @@ import importlib from .compat import basestring_ from .cli.info import info from .glossary import explain +from .deprecated import resolve_load_name from . import util def load(name, **overrides): - name = util.resolve_load_name(name, **overrides) + name = 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/deprecated.py b/spacy/deprecated.py index 3afd7f3a2..c3b50cd85 100644 --- a/spacy/deprecated.py +++ b/spacy/deprecated.py @@ -21,3 +21,13 @@ def depr_model_download(lang): "Downloading default '%s' model now..." % lang, title="Warning: deprecated command") download(lang) + + +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. " + "The model meta is used to load the required Language class.", + "OLD: spacy.load('en', path='/some/path')", "NEW: spacy.load('/some/path')", + title="Warning: deprecated argument 'path'") + return name diff --git a/spacy/util.py b/spacy/util.py index fe2d18f57..e9616468c 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -55,16 +55,6 @@ def ensure_path(path): return path -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. " - "The model meta is used to load the required Language class.", - "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():