Fix pos name conflict in lemmatize

This commit is contained in:
Matthew Honnibal 2016-09-27 17:35:58 +02:00
parent 35cd953f9e
commit 07776d8096
1 changed files with 3 additions and 3 deletions

View File

@ -96,15 +96,15 @@ cdef class Morphology:
self.tag_map.get(tag_str, {})) self.tag_map.get(tag_str, {}))
self._cache.set(tag_id, orth, <void*>cached) self._cache.set(tag_id, orth, <void*>cached)
def lemmatize(self, const univ_pos_t pos, attr_t orth, **morphology): def lemmatize(self, const univ_pos_t univ_pos, attr_t orth, **morphology):
cdef unicode py_string = self.strings[orth] cdef unicode py_string = self.strings[orth]
if self.lemmatizer is None: if self.lemmatizer is None:
return self.strings[py_string.lower()] return self.strings[py_string.lower()]
if pos != NOUN and pos != VERB and pos != ADJ and pos != PUNCT: if univ_pos not in (NOUN, VERB, ADJ, PUNCT):
return self.strings[py_string.lower()] return self.strings[py_string.lower()]
cdef set lemma_strings cdef set lemma_strings
cdef unicode lemma_string cdef unicode lemma_string
lemma_strings = self.lemmatizer(py_string, pos, **morphology) lemma_strings = self.lemmatizer(py_string, univ_pos, **morphology)
lemma_string = sorted(lemma_strings)[0] lemma_string = sorted(lemma_strings)[0]
lemma = self.strings[lemma_string] lemma = self.strings[lemma_string]
return lemma return lemma