mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-06 05:10:21 +03:00
Remove old model shortcuts
This commit is contained in:
parent
e79910d57e
commit
bce35ad585
|
@ -8,7 +8,6 @@ from ._util import app, Arg, Opt, WHEEL_SUFFIX, SDIST_SUFFIX
|
|||
from .. import about
|
||||
from ..util import is_package, get_minor_version, run_command
|
||||
from ..util import is_prerelease_version
|
||||
from ..errors import OLD_MODEL_SHORTCUTS
|
||||
|
||||
|
||||
@app.command(
|
||||
|
@ -61,12 +60,6 @@ def download(
|
|||
version = components[-1]
|
||||
else:
|
||||
model_name = model
|
||||
if model in OLD_MODEL_SHORTCUTS:
|
||||
msg.warn(
|
||||
f"As of spaCy v3.0, shortcuts like '{model}' are deprecated. Please "
|
||||
f"use the full pipeline package name '{OLD_MODEL_SHORTCUTS[model]}' instead."
|
||||
)
|
||||
model_name = OLD_MODEL_SHORTCUTS[model]
|
||||
compatibility = get_compatibility()
|
||||
version = get_version(model_name, compatibility)
|
||||
|
||||
|
|
|
@ -957,15 +957,6 @@ class Errors(metaclass=ErrorsWithCodes):
|
|||
"but got '{received_type}'")
|
||||
|
||||
|
||||
# Deprecated model shortcuts, only used in errors and warnings
|
||||
OLD_MODEL_SHORTCUTS = {
|
||||
"en": "en_core_web_sm", "de": "de_core_news_sm", "es": "es_core_news_sm",
|
||||
"pt": "pt_core_news_sm", "fr": "fr_core_news_sm", "it": "it_core_news_sm",
|
||||
"nl": "nl_core_news_sm", "el": "el_core_news_sm", "nb": "nb_core_news_sm",
|
||||
"lt": "lt_core_news_sm", "xx": "xx_ent_wiki_sm"
|
||||
}
|
||||
|
||||
|
||||
# fmt: on
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ except ImportError:
|
|||
|
||||
from .symbols import ORTH
|
||||
from .compat import cupy, CudaStream, is_windows, importlib_metadata
|
||||
from .errors import Errors, Warnings, OLD_MODEL_SHORTCUTS
|
||||
from . import about
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
@ -428,8 +427,6 @@ def load_model(
|
|||
return load_model_from_path(Path(name), **kwargs) # type: ignore[arg-type]
|
||||
elif hasattr(name, "exists"): # Path or Path-like to model data
|
||||
return load_model_from_path(name, **kwargs) # type: ignore[arg-type]
|
||||
if name in OLD_MODEL_SHORTCUTS:
|
||||
raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) # type: ignore[index]
|
||||
raise IOError(Errors.E050.format(name=name))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user