Fix #617: Vocab.load() required Path. Should work with string as well.

This commit is contained in:
Matthew Honnibal 2016-11-10 22:48:48 +01:00
parent e86f440ca6
commit f123f92e0c
1 changed files with 3 additions and 1 deletions

View File

@ -6,8 +6,8 @@ from libc.stdint cimport int32_t
from libc.stdint cimport uint64_t from libc.stdint cimport uint64_t
from libc.math cimport sqrt from libc.math cimport sqrt
from pathlib import Path
import bz2 import bz2
from os import path
import io import io
import math import math
import ujson as json import ujson as json
@ -71,6 +71,8 @@ cdef class Vocab:
Returns: Returns:
Vocab: The newly constructed vocab object. Vocab: The newly constructed vocab object.
""" """
if isinstance(path, basestring):
path = Path(path)
util.check_renamed_kwargs({'get_lex_attr': 'lex_attr_getters'}, deprecated_kwargs) util.check_renamed_kwargs({'get_lex_attr': 'lex_attr_getters'}, deprecated_kwargs)
if 'vectors' in deprecated_kwargs: if 'vectors' in deprecated_kwargs:
raise AttributeError( raise AttributeError(