mirror of https://github.com/explosion/spaCy.git
Use lookup lemmatizer if lemma unset
This commit is contained in:
parent
db5c714ad2
commit
fb26b2cb12
|
@ -257,7 +257,11 @@ cdef class Token:
|
||||||
inflectional suffixes.
|
inflectional suffixes.
|
||||||
"""
|
"""
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.c.lemma
|
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):
|
def __set__(self, attr_t lemma):
|
||||||
self.c.lemma = lemma
|
self.c.lemma = lemma
|
||||||
|
@ -724,7 +728,10 @@ cdef class Token:
|
||||||
with no inflectional suffixes.
|
with no inflectional suffixes.
|
||||||
"""
|
"""
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.vocab.strings[self.c.lemma]
|
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_):
|
def __set__(self, unicode lemma_):
|
||||||
self.c.lemma = self.vocab.strings.add(lemma_)
|
self.c.lemma = self.vocab.strings.add(lemma_)
|
||||||
|
|
Loading…
Reference in New Issue