From 9eae9837c4b97a681fdfe52f6380ab56fe7b6065 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 6 Sep 2015 17:53:39 +0200 Subject: [PATCH] * Fix morphology look up --- spacy/morphology.pyx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spacy/morphology.pyx b/spacy/morphology.pyx index 12d435c7d..fc6a4936b 100644 --- a/spacy/morphology.pyx +++ b/spacy/morphology.pyx @@ -30,7 +30,11 @@ cdef class Morphology: cdef int assign_tag(self, TokenC* token, tag) except -1: cdef int tag_id 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: tag_id = tag analysis = self._cache.get(tag_id, token.lex.orth)