From 1f1532142fc9fdf000b5fa631e3161e891b8c30a Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 3 May 2016 00:21:08 +0200 Subject: [PATCH] * Fix cost calculation on non-monotonic oracle --- spacy/syntax/arc_eager.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/syntax/arc_eager.pyx b/spacy/syntax/arc_eager.pyx index 4c6bf4742..d44183022 100644 --- a/spacy/syntax/arc_eager.pyx +++ b/spacy/syntax/arc_eager.pyx @@ -186,7 +186,7 @@ cdef class LeftArc: for i in range(1, s.stack_depth()): cost += gold.heads[s.S(i)] == s.S(0) cost += gold.heads[s.S(0)] == s.S(i) - return pop_cost(s, gold, s.S(0)) + arc_cost(s, gold, s.B(0), s.S(0)) + return cost + pop_cost(s, gold, s.S(0)) + arc_cost(s, gold, s.B(0), s.S(0)) @staticmethod cdef inline weight_t label_cost(StateClass s, const GoldParseC* gold, int label) nogil: