2014-12-15 21:06:04 +00:00
|
|
|
from cymem.cymem cimport Pool
|
|
|
|
|
|
|
|
from thinc.typedefs cimport weight_t
|
|
|
|
|
|
|
|
|
|
|
|
from ._state cimport State
|
|
|
|
|
|
|
|
|
|
|
|
cdef struct Transition:
|
|
|
|
int move
|
|
|
|
int label
|
|
|
|
|
|
|
|
|
|
|
|
cdef class TransitionSystem:
|
|
|
|
cdef Pool mem
|
|
|
|
cdef readonly int n_moves
|
2014-12-16 11:44:43 +00:00
|
|
|
cdef dict label_ids
|
2014-12-15 21:06:04 +00:00
|
|
|
|
|
|
|
cdef const Transition* _moves
|
|
|
|
|
2014-12-20 18:36:29 +00:00
|
|
|
cdef Transition best_valid(self, const weight_t* scores, const State* s) except -1
|
|
|
|
cdef Transition best_gold(self, const weight_t* scores, const State* s,
|
|
|
|
int* gold_heads, int* gold_labels) except -1
|
2014-12-18 00:33:25 +00:00
|
|
|
cdef int transition(self, State *s, const Transition* t) except -1
|