From d108534dc289f4f1342194be8cc0151bad769153 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 8 Mar 2017 01:37:52 +0100 Subject: [PATCH] Fix 2/3 problems for training --- spacy/en/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spacy/en/__init__.py b/spacy/en/__init__.py index 56cf4d184..f39faf308 100644 --- a/spacy/en/__init__.py +++ b/spacy/en/__init__.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals, print_function from os import path +from pathlib import Path from ..util import match_best_version from ..util import get_data_path @@ -13,6 +14,11 @@ from ..attrs import LANG from .language_data import * +try: + basestring +except NameError: + basestring = str + class English(Language): lang = 'en' @@ -43,14 +49,15 @@ def _fix_deprecated_glove_vectors_loading(overrides): data_path = get_data_path() else: path = overrides['path'] + if isinstance(path, basestring): + path = Path(path) data_path = path.parent vec_path = None if 'add_vectors' not in overrides: if 'vectors' in overrides: vec_path = match_best_version(overrides['vectors'], None, data_path) if vec_path is None: - raise IOError( - 'Could not load data pack %s from %s' % (overrides['vectors'], data_path)) + return overrides else: vec_path = match_best_version('en_glove_cc_300_1m_vectors', None, data_path) if vec_path is not None: