From 8253581057e23768ad9863737eb03b9e987840ab Mon Sep 17 00:00:00 2001 From: ines Date: Thu, 16 Mar 2017 19:54:51 +0100 Subject: [PATCH] Link model automatically if not direct download --- spacy/download.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spacy/download.py b/spacy/download.py index b00f11d18..1f8f701ff 100644 --- a/spacy/download.py +++ b/spacy/download.py @@ -5,6 +5,7 @@ import pip import plac import requests from os import path +from .link import link from . import about from . import util @@ -21,11 +22,11 @@ def download(model=None, direct=False): if direct: download_model('{m}/{m}.tar.gz'.format(m=model)) else: - model = about.__shortcuts__[model] if model in about.__shortcuts__ else model + model_name = about.__shortcuts__[model] if model in about.__shortcuts__ else model compatibility = get_compatibility() - version = get_version(model, compatibility) - download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model, v=version)) - + version = get_version(model_name, compatibility) + download_model('{m}-{v}/{m}-{v}.tar.gz'.format(m=model_name, v=version)) + link(model_name, model, force=True) def get_compatibility(): version = about.__version__