mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-04 21:50:35 +03:00
* Add is_valid method to transition_system
This commit is contained in:
parent
2a46c77324
commit
cc9deae960
|
@ -54,6 +54,10 @@ cdef class TransitionSystem:
|
||||||
cdef Transition init_transition(self, int clas, int move, int label) except *:
|
cdef Transition init_transition(self, int clas, int move, int label) except *:
|
||||||
raise NotImplementedError
|
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 set_valid(self, int* is_valid, StateClass stcls) nogil:
|
||||||
cdef int i
|
cdef int i
|
||||||
for i in range(self.n_moves):
|
for i in range(self.n_moves):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user