mirror of https://github.com/explosion/spaCy.git
Fix spacy.load
This commit is contained in:
parent
8c8f5c62c6
commit
76c815f40d
|
@ -19,43 +19,13 @@ set_lang_class(de.German.lang, de.German)
|
|||
set_lang_class(zh.Chinese.lang, zh.Chinese)
|
||||
|
||||
|
||||
def blank(name, vocab=None, tokenizer=None, parser=None, tagger=None, entity=None,
|
||||
matcher=None, serializer=None, vectors=None, pipeline=None):
|
||||
def load(name, **overrides):
|
||||
target_name, target_version = util.split_data_name(name)
|
||||
cls = get_lang_class(target_name)
|
||||
return cls(
|
||||
path=None,
|
||||
vectors=vectors,
|
||||
vocab=vocab,
|
||||
tokenizer=tokenizer,
|
||||
tagger=tagger,
|
||||
parser=parser,
|
||||
entity=entity,
|
||||
matcher=matcher,
|
||||
pipeline=pipeline,
|
||||
serializer=serializer)
|
||||
path = overrides.get('path', util.get_data_path())
|
||||
path = util.match_best_version(target_name, target_version, path)
|
||||
|
||||
|
||||
def load(name, vocab=True, tokenizer=True, parser=True, tagger=True, entity=True,
|
||||
matcher=True, serializer=True, vectors=True, pipeline=True, via=None):
|
||||
if via is None:
|
||||
via = util.get_data_path()
|
||||
|
||||
target_name, target_version = util.split_data_name(name)
|
||||
path = util.match_best_version(target_name, target_version, via)
|
||||
|
||||
if isinstance(vectors, basestring):
|
||||
vectors = util.match_best_version(vectors, None, via)
|
||||
if isinstance(overrides.get('vectors'), basestring):
|
||||
vectors = util.match_best_version(overrides.get('vectors'), None, path)
|
||||
|
||||
cls = get_lang_class(target_name)
|
||||
return cls(
|
||||
path,
|
||||
vectors=vectors,
|
||||
vocab=vocab,
|
||||
tokenizer=tokenizer,
|
||||
tagger=tagger,
|
||||
parser=parser,
|
||||
entity=entity,
|
||||
matcher=matcher,
|
||||
pipeline=pipeline,
|
||||
serializer=serializer)
|
||||
return cls(path=path, **overrides)
|
||||
|
|
Loading…
Reference in New Issue