mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
Simplify deprecated model downloading
Only relevant for spaCy < v1.7.0.
This commit is contained in:
parent
95edd9e896
commit
bd6a7cf4f6
|
@ -1,5 +1,8 @@
|
|||
from ..deprecated import ModelDownload as download
|
||||
# coding: utf8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from ..deprecated import depr_model_download
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
download.de()
|
||||
depr_model_download('de')
|
||||
|
|
|
@ -86,26 +86,14 @@ def resolve_model_name(name):
|
|||
return name
|
||||
|
||||
|
||||
class ModelDownload():
|
||||
def depr_model_download(lang):
|
||||
"""
|
||||
Replace download modules within en and de with deprecation warning and
|
||||
download default language model (using shortcut). Use classmethods to allow
|
||||
importing ModelDownload as download and calling download.en() etc.
|
||||
download default language model (using shortcut).
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def load(self, lang):
|
||||
prints("The spacy.%s.download command is now deprecated. Please use "
|
||||
"python -m spacy download [model name or shortcut] instead. For "
|
||||
"more info, see the docs: %s." % (lang, about.__docs__),
|
||||
"Downloading default '%s' model now..." % lang,
|
||||
title="Warning: deprecated command")
|
||||
download(lang)
|
||||
|
||||
@classmethod
|
||||
def en(cls, *args, **kwargs):
|
||||
cls.load('en')
|
||||
|
||||
@classmethod
|
||||
def de(cls, *args, **kwargs):
|
||||
cls.load('de')
|
||||
prints("The spacy.%s.download command is now deprecated. Please use "
|
||||
"python -m spacy download [model name or shortcut] instead. For "
|
||||
"more info, see the docs: %s." % (lang, about.__docs__),
|
||||
"Downloading default '%s' model now..." % lang,
|
||||
title="Warning: deprecated command")
|
||||
download(lang)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
from ..deprecated import ModelDownload as download
|
||||
# coding: utf8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from ..deprecated import depr_model_download
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
download.en()
|
||||
depr_model_download('en')
|
||||
|
|
Loading…
Reference in New Issue
Block a user