From 4f83c9b3d5ed6b0b7b6dcb0c2afae401241f5b12 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 22 Feb 2015 18:18:54 -0500 Subject: [PATCH] * Make costs label-sensitive --- spacy/syntax/arc_eager.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/syntax/arc_eager.pyx b/spacy/syntax/arc_eager.pyx index 97efc1bd6..f4391773e 100644 --- a/spacy/syntax/arc_eager.pyx +++ b/spacy/syntax/arc_eager.pyx @@ -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)