* Fix morphology look up

This commit is contained in:
Matthew Honnibal 2015-09-06 17:53:39 +02:00
parent 6427a3fcac
commit 9eae9837c4
1 changed files with 5 additions and 1 deletions

View File

@ -30,7 +30,11 @@ cdef class Morphology:
cdef int assign_tag(self, TokenC* token, tag) except -1: cdef int assign_tag(self, TokenC* token, tag) except -1:
cdef int tag_id cdef int tag_id
if isinstance(tag, basestring): if isinstance(tag, basestring):
tag_id = self.reverse_index[self.strings[tag]] try:
tag_id = self.reverse_index[self.strings[tag]]
except KeyError:
print tag
raise
else: else:
tag_id = tag tag_id = tag
analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth) analysis = <MorphAnalysisC*>self._cache.get(tag_id, token.lex.orth)