From cc9deae9600456b2cda8c605e1487a8d97778b26 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 8 Aug 2015 23:36:18 +0200 Subject: [PATCH] * Add is_valid method to transition_system --- spacy/syntax/transition_system.pyx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spacy/syntax/transition_system.pyx b/spacy/syntax/transition_system.pyx index 00395333f..86aef1fbc 100644 --- a/spacy/syntax/transition_system.pyx +++ b/spacy/syntax/transition_system.pyx @@ -54,6 +54,10 @@ cdef class TransitionSystem: cdef Transition init_transition(self, int clas, int move, int label) except *: raise NotImplementedError + def is_valid(self, StateClass stcls, move_name): + action = self.lookup_transition(move_name) + return action.is_valid(stcls, action.label) + cdef int set_valid(self, int* is_valid, StateClass stcls) nogil: cdef int i for i in range(self.n_moves):