Use lookup lemmatizer if lemma unset
@@ -257,6 +257,10 @@ cdef class Token:
inflectional suffixes.
"""
def __get__(self):
+ if self.c.lemma == 0:
+ lemma = self.vocab.morphology.lemmatizer.lookup(self.orth_)
+ return lemma
+ else:
return self.c.lemma
def __set__(self, attr_t lemma):
@@ -724,6 +728,9 @@ cdef class Token:
with no inflectional suffixes.
"""
def __get__(self):
+ if self.c.lemma == 0:
+ return self.vocab.morphology.lemmatizer.lookup(self.orth_)
+ else:
return self.vocab.strings[self.c.lemma]
def __set__(self, unicode lemma_):
