From 5610fdcc064877174f383654b615c1c97b2ff96d Mon Sep 17 00:00:00 2001 From: ines Date: Sun, 16 Apr 2017 22:16:47 +0200 Subject: [PATCH] Get language name first if no model path exists Makes sure spaCy fails early if no tokenizer exists, and allows printing better error message. --- spacy/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/__init__.py b/spacy/__init__.py index 22f406771..efd6c00c0 100644 --- a/spacy/__init__.py +++ b/spacy/__init__.py @@ -23,9 +23,10 @@ def load(name, **overrides): model_name = resolve_model_name(name) model_path = data_path / model_name if not model_path.exists(): + lang_name = util.get_lang_class(name).lang model_path = None util.print_msg( - "Only loading the '{}' tokenizer.".format(name), + "Only loading the '{}' tokenizer.".format(lang_name), title="Warning: no model found for '{}'".format(name)) else: model_path = util.ensure_path(overrides['path'])