mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-05 13:43:24 +03:00
Fix lex.id if vectors is None
This commit is contained in:
parent
2f169fdb0a
commit
8e65247886
|
@ -155,7 +155,10 @@ cdef class Vocab:
|
||||||
lex = <LexemeC*>mem.alloc(sizeof(LexemeC), 1)
|
lex = <LexemeC*>mem.alloc(sizeof(LexemeC), 1)
|
||||||
lex.orth = self.strings.add(string)
|
lex.orth = self.strings.add(string)
|
||||||
lex.length = len(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:
|
if self.lex_attr_getters is not None:
|
||||||
for attr, func in self.lex_attr_getters.items():
|
for attr, func in self.lex_attr_getters.items():
|
||||||
value = func(string)
|
value = func(string)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user