From f123f92e0c92ec824c8f8ff3f9d0072ed9c93254 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 10 Nov 2016 22:48:48 +0100 Subject: [PATCH] Fix #617: Vocab.load() required Path. Should work with string as well. --- spacy/vocab.pyx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/vocab.pyx b/spacy/vocab.pyx index feef43ae5..9938f6b9c 100644 --- a/spacy/vocab.pyx +++ b/spacy/vocab.pyx @@ -6,8 +6,8 @@ from libc.stdint cimport int32_t from libc.stdint cimport uint64_t from libc.math cimport sqrt +from pathlib import Path import bz2 -from os import path import io import math import ujson as json @@ -71,6 +71,8 @@ cdef class Vocab: Returns: 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) if 'vectors' in deprecated_kwargs: raise AttributeError(