* Update for faster beam training

This commit is contained in:
Matthew Honnibal 2015-06-04 19:32:32 +02:00
parent f8843906ad
commit 079dad28a7
2 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,8 @@ cdef class TransitionSystem:
cdef int set_valid(self, bint* output, const State* state) except -1 cdef int set_valid(self, bint* output, const State* state) except -1
cdef int set_costs(self, int* output, const State* state, GoldParse gold) except -1
cdef Transition best_valid(self, const weight_t* scores, const State* state) except * cdef Transition best_valid(self, const weight_t* scores, const State* state) except *
cdef Transition best_gold(self, const weight_t* scores, const State* state, cdef Transition best_gold(self, const weight_t* scores, const State* state,

View File

@ -48,6 +48,11 @@ cdef class TransitionSystem:
cdef int set_valid(self, bint* output, const State* state) except -1: cdef int set_valid(self, bint* output, const State* state) except -1:
raise NotImplementedError raise NotImplementedError
cdef int set_costs(self, int* output, const State* s, GoldParse gold) except -1:
cdef int i
for i in range(self.n_moves):
output[i] = self.c[i].get_cost(&self.c[i], s, &gold.c)
cdef Transition best_gold(self, const weight_t* scores, const State* s, cdef Transition best_gold(self, const weight_t* scores, const State* s,
GoldParse gold) except *: GoldParse gold) except *:
cdef Transition best cdef Transition best