Fix download.py for GloVe vectors.

This commit is contained in:
Matthew Honnibal 2016-10-19 00:47:44 +02:00
parent edc45c19d6
commit 5a5c7192a5

View File

@ -14,7 +14,8 @@ def download(lang, force=False, fail_on_exist=True):
sputnik.purge(about.__title__, about.__version__)
try:
sputnik.package(about.__title__, about.__version__, about.__models__[lang])
sputnik.package(about.__title__, about.__version__,
about.__models__.get(lang, lang))
if fail_on_exist:
print("Model already installed. Please run 'python -m "
"spacy.%s.download --force' to reinstall." % lang, file=sys.stderr)
@ -22,10 +23,12 @@ def download(lang, force=False, fail_on_exist=True):
except (PackageNotFoundException, CompatiblePackageNotFoundException):
pass
package = sputnik.install(about.__title__, about.__version__, about.__models__[lang])
package = sputnik.install(about.__title__, about.__version__,
about.__models__.get(lang, lang))
try:
sputnik.package(about.__title__, about.__version__, about.__models__[lang])
sputnik.package(about.__title__, about.__version__,
about.__models__.get(lang, lang))
except (PackageNotFoundException, CompatiblePackageNotFoundException):
print("Model failed to install. Please run 'python -m "
"spacy.%s.download --force'." % lang, file=sys.stderr)