From 4405b5c87567a9b22d70bfaa35ba7e318554718d Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 10 Dec 2018 06:31:00 +0100 Subject: [PATCH] Fix resizing edge-case for NER --- spacy/syntax/ner.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/ner.pyx b/spacy/syntax/ner.pyx index 3f6d96304..ec79bf641 100644 --- a/spacy/syntax/ner.pyx +++ b/spacy/syntax/ner.pyx @@ -207,15 +207,16 @@ cdef class BiluoPushDown(TransitionSystem): else: label_id = label_name if action == OUT and label_id != 0: - return + return None if action == MISSING or action == ISNT: - return + return None # Check we're not creating a move we already have, so that this is # idempotent for trans in self.c[:self.n_moves]: if trans.move == action and trans.label == label_id: return 0 if self.n_moves >= self._size: + self._size = self.n_moves self._size *= 2 self.c = self.mem.realloc(self.c, self._size * sizeof(self.c[0])) self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id)