From c8e0011ebcb393c4edae8679a06d9e812735c0dd Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 19 Jan 2016 19:07:43 +0100 Subject: [PATCH] * Add iterators to the NER and parser transition systems, to get the action types --- spacy/syntax/arc_eager.pyx | 4 ++++ spacy/syntax/ner.pyx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/spacy/syntax/arc_eager.pyx b/spacy/syntax/arc_eager.pyx index 79c75646d..65bac8885 100644 --- a/spacy/syntax/arc_eager.pyx +++ b/spacy/syntax/arc_eager.pyx @@ -299,6 +299,10 @@ cdef class ArcEager(TransitionSystem): move_labels[LEFT][label] = True return move_labels + property action_types: + def __get__(self): + return (SHIFT, REDUCE, LEFT, RIGHT, BREAK) + cdef int preprocess_gold(self, GoldParse gold) except -1: for i in range(gold.length): if gold.heads[i] is None: # Missing values diff --git a/spacy/syntax/ner.pyx b/spacy/syntax/ner.pyx index 1c8251bc7..750b521a0 100644 --- a/spacy/syntax/ner.pyx +++ b/spacy/syntax/ner.pyx @@ -65,6 +65,10 @@ cdef class BiluoPushDown(TransitionSystem): move_labels[moves.index(move_str)][label] = True return move_labels + property action_types: + def __get__(self): + return (BEGIN, IN, LAST, UNIT, OUT) + def move_name(self, int move, int label): if move == OUT: return 'O'