From 76c815f40d86243ee27b8fac8318a8641ed35ca6 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 18 Oct 2016 19:23:31 +0200 Subject: [PATCH] Fix spacy.load --- spacy/__init__.py | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/spacy/__init__.py b/spacy/__init__.py index 90f23e339..030616ca7 100644 --- a/spacy/__init__.py +++ b/spacy/__init__.py @@ -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)