mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +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__':
|
if __name__ == '__main__':
|
||||||
download.de()
|
depr_model_download('de')
|
||||||
|
|
|
@ -86,26 +86,14 @@ def resolve_model_name(name):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
class ModelDownload():
|
def depr_model_download(lang):
|
||||||
"""
|
"""
|
||||||
Replace download modules within en and de with deprecation warning and
|
Replace download modules within en and de with deprecation warning and
|
||||||
download default language model (using shortcut). Use classmethods to allow
|
download default language model (using shortcut).
|
||||||
importing ModelDownload as download and calling download.en() etc.
|
|
||||||
"""
|
"""
|
||||||
|
prints("The spacy.%s.download command is now deprecated. Please use "
|
||||||
@classmethod
|
"python -m spacy download [model name or shortcut] instead. For "
|
||||||
def load(self, lang):
|
"more info, see the docs: %s." % (lang, about.__docs__),
|
||||||
prints("The spacy.%s.download command is now deprecated. Please use "
|
"Downloading default '%s' model now..." % lang,
|
||||||
"python -m spacy download [model name or shortcut] instead. For "
|
title="Warning: deprecated command")
|
||||||
"more info, see the docs: %s." % (lang, about.__docs__),
|
download(lang)
|
||||||
"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')
|
|
||||||
|
|
|
@ -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__':
|
if __name__ == '__main__':
|
||||||
download.en()
|
depr_model_download('en')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user