* Make costs label-sensitive

This commit is contained in:
Matthew Honnibal 2015-02-22 18:18:54 -05:00
parent 179b7eb0a7
commit 4f83c9b3d5
1 changed files with 2 additions and 0 deletions

View File

@ -139,6 +139,7 @@ cdef int _right_cost(const Transition* self, const State* s, GoldParse gold) exc
assert s.stack_len >= 1
cost = 0
if gold[s.i] == s.stack[0]:
cost += self.label != gold.c_labels[s.i]
return cost
cost += head_in_buffer(s, s.i, gold.c_heads)
cost += children_in_stack(s, s.i, gold.c_heads)
@ -152,6 +153,7 @@ cdef int _left_cost(const Transition* self, const State* s, GoldParse gold) exce
assert s.stack_len >= 1
cost = 0
if gold[s.stack[0]] == s.i:
cost += self.label != gold.c_labels[s.top]
return cost
cost += head_in_buffer(s, s.stack[0], gold.c_heads)