From c003c561c34daa216f3a96176bc3e739cff4439a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 17 Sep 2017 05:46:03 -0500 Subject: [PATCH] Revert NER action loading change, for model compatibility --- spacy/syntax/ner.pyx | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/spacy/syntax/ner.pyx b/spacy/syntax/ner.pyx index 1a174aba8..d8c748099 100644 --- a/spacy/syntax/ner.pyx +++ b/spacy/syntax/ner.pyx @@ -219,28 +219,28 @@ cdef class BiluoPushDown(TransitionSystem): raise Exception(move) return t - def add_action(self, int action, label_name): - cdef attr_t label_id - if not isinstance(label_name, (int, long)): - label_id = self.strings.add(label_name) - else: - label_id = label_name - if action == OUT and label_id != 0: - return - if action == MISSING or action == ISNT: - return - # 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 *= 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) - assert self.c[self.n_moves].label == label_id - self.n_moves += 1 - return 1 + #def add_action(self, int action, label_name): + # cdef attr_t label_id + # if not isinstance(label_name, (int, long)): + # label_id = self.strings.add(label_name) + # else: + # label_id = label_name + # if action == OUT and label_id != 0: + # return + # if action == MISSING or action == ISNT: + # return + # # 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 *= 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) + # assert self.c[self.n_moves].label == label_id + # self.n_moves += 1 + # return 1