Return Transition for missing actions in lookup_action

This commit is contained in:
Matthew Honnibal 2017-08-06 14:16:36 +02:00
parent 4a5cc89138
commit 78498a072d
2 changed files with 3 additions and 0 deletions

View File

@ -385,6 +385,7 @@ cdef class ArcEager(TransitionSystem):
for i in range(self.n_moves):
if self.c[i].move == move and self.c[i].label == label:
return self.c[i]
return Transition(clas=0, move=MISSING, label=0)
def move_name(self, int move, attr_t label):
label_str = self.strings[label]

View File

@ -107,6 +107,8 @@ cdef class TransitionSystem:
def is_valid(self, StateClass stcls, move_name):
action = self.lookup_transition(move_name)
if action.move == 0:
return False
return action.is_valid(stcls.c, action.label)
cdef int set_valid(self, int* is_valid, const StateC* st) nogil: