* Check serializer freqs exist before loading

This commit is contained in:
Matthew Honnibal 2015-09-12 23:40:01 +02:00
parent 17eacf8f70
commit a412c66c8c
1 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,10 @@ cdef class Vocab:
tag_map = json.load(open(path.join(data_dir, 'tag_map.json')))
lemmatizer = Lemmatizer.from_dir(path.join(data_dir, '..'))
serializer_freqs = json.load(open(path.join(data_dir, 'serializer.json')))
if path.exists(path.join(data_dir, 'serializer.json')):
serializer_freqs = json.load(open(path.join(data_dir, 'serializer.json')))
else:
serialize_feqs=None
cdef Vocab self = cls(get_lex_attr=get_lex_attr, vectors=vectors, tag_map=tag_map,
lemmatizer=lemmatizer, serializer_freqs=serializer_freqs)