* Add iterators to the NER and parser transition systems, to get the action types

This commit is contained in:
Matthew Honnibal 2016-01-19 19:07:43 +01:00
parent 515493c675
commit c8e0011ebc
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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'