Fix lex.id if vectors is None

This commit is contained in:
ines 2017-11-15 14:23:58 +01:00
parent 2f169fdb0a
commit 8e65247886

View File

@ -155,7 +155,10 @@ cdef class Vocab:
lex = <LexemeC*>mem.alloc(sizeof(LexemeC), 1)
lex.orth = self.strings.add(string)
lex.length = len(string)
lex.id = self.vectors.key2row.get(lex.orth, 0)
if self.vectors is not None:
lex.id = self.vectors.key2row.get(lex.orth, 0)
else:
lex.id = 0
if self.lex_attr_getters is not None:
for attr, func in self.lex_attr_getters.items():
value = func(string)