From 082e95b19e731f3e38085728fee6a4205094af11 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 24 Sep 2016 22:09:21 +0200 Subject: [PATCH] Python 3 compatible basestring --- spacy/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spacy/__init__.py b/spacy/__init__.py index da038a9fe..1177e726d 100644 --- a/spacy/__init__.py +++ b/spacy/__init__.py @@ -7,13 +7,20 @@ from . import de from . import zh +try: + basestring +except NameError: + basestring = str + + + set_lang_class(en.English.lang, en.English) set_lang_class(de.German.lang, de.German) set_lang_class(zh.Chinese.lang, zh.Chinese) def load(name, vocab=True, tokenizer=True, parser=True, tagger=True, entity=True, - matcher=True, serializer=True, vectors=True, via=None): + matcher=True, serializer=True, vectors=True, pipeline=True, via=None): if via is None: via = util.get_data_path() @@ -21,8 +28,7 @@ def load(name, vocab=True, tokenizer=True, parser=True, tagger=True, entity=True path = util.match_best_version(target_name, target_version, via) if isinstance(vectors, basestring): - vectors_name, vectors_version = util.split_data_name(vectors) - vectors = util.match_best_version(vectors_name, vectors_version, via) + vectors = util.match_best_version(vectors, None, via) cls = get_lang_class(target_name) return cls( @@ -34,4 +40,5 @@ def load(name, vocab=True, tokenizer=True, parser=True, tagger=True, entity=True parser=parser, entity=entity, matcher=matcher, + pipeline=pipeline, serializer=serializer)