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
1 changed files with 6 additions and 3 deletions

View File

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