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