From 5887506f5deeeb187b1e92193322f3b66c5a0b46 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 3 Nov 2015 13:23:39 +1100 Subject: [PATCH] * Don't expect lexemes.bin in Vocab --- spacy/vocab.pyx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spacy/vocab.pyx b/spacy/vocab.pyx index cda1d6ddb..aa2a069dd 100644 --- a/spacy/vocab.pyx +++ b/spacy/vocab.pyx @@ -62,9 +62,11 @@ cdef class Vocab: cdef Vocab self = cls(get_lex_attr=get_lex_attr, tag_map=tag_map, lemmatizer=lemmatizer, serializer_freqs=serializer_freqs) - with io.open(path.join(data_dir, 'strings.json'), 'r', encoding='utf8') as file_: - self.strings.load(file_) - self.load_lexemes(path.join(data_dir, 'lexemes.bin')) + if path.exists(path.join(data_dir, 'strings.json')): + with io.open(path.join(data_dir, 'strings.json'), 'r', encoding='utf8') as file_: + self.strings.load(file_) + self.load_lexemes(path.join(data_dir, 'lexemes.bin')) + if path.exists(path.join(data_dir, 'vec.bin')): self.vectors_length = self.load_vectors_from_bin_loc(path.join(data_dir, 'vec.bin')) return self