mirror of https://github.com/explosion/spaCy.git
Get language name first if no model path exists
Makes sure spaCy fails early if no tokenizer exists, and allows printing better error message.
This commit is contained in:
parent
ad168ba88c
commit
5610fdcc06
|
@ -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'])
|
||||
|
|
Loading…
Reference in New Issue