mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
* Edits to arc eager oracle. Couldn't figure out how the non-monotonic lines made sense. They seem covered by children_in_stack
This commit is contained in:
parent
6c5632b71c
commit
5e99ff94c8
|
@ -238,8 +238,6 @@ cdef int _shift_cost(const Transition* self, const State* s, GoldParse gold) exc
|
||||||
cost = 0
|
cost = 0
|
||||||
cost += head_in_stack(s, s.i, gold.c_heads)
|
cost += head_in_stack(s, s.i, gold.c_heads)
|
||||||
cost += children_in_stack(s, s.i, gold.c_heads)
|
cost += children_in_stack(s, s.i, gold.c_heads)
|
||||||
if NON_MONOTONIC:
|
|
||||||
cost += gold.c_heads[s.stack[0]] == s.i
|
|
||||||
# If we can break, and there's no cost to doing so, we should
|
# If we can break, and there's no cost to doing so, we should
|
||||||
if _can_break(s) and _break_cost(self, s, gold) == 0:
|
if _can_break(s) and _break_cost(self, s, gold) == 0:
|
||||||
cost += 1
|
cost += 1
|
||||||
|
@ -258,8 +256,6 @@ cdef int _right_cost(const Transition* self, const State* s, GoldParse gold) exc
|
||||||
cost += head_in_buffer(s, s.i, gold.c_heads)
|
cost += head_in_buffer(s, s.i, gold.c_heads)
|
||||||
cost += children_in_stack(s, s.i, gold.c_heads)
|
cost += children_in_stack(s, s.i, gold.c_heads)
|
||||||
cost += head_in_stack(s, s.i, gold.c_heads)
|
cost += head_in_stack(s, s.i, gold.c_heads)
|
||||||
if NON_MONOTONIC:
|
|
||||||
cost += gold.c_heads[s.stack[0]] == s.i
|
|
||||||
return cost
|
return cost
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,9 +270,11 @@ cdef int _left_cost(const Transition* self, const State* s, GoldParse gold) exce
|
||||||
elif at_eol(s):
|
elif at_eol(s):
|
||||||
# Are we root?
|
# Are we root?
|
||||||
if gold.c_labels[s.stack[0]] != -1:
|
if gold.c_labels[s.stack[0]] != -1:
|
||||||
cost += gold.c_heads[s.stack[0]] != s.stack[0]
|
# If we're at EOL, prefer to reduce or break over left-arc
|
||||||
# Are we labelling correctly?
|
if _can_reduce(s) or _can_break(s):
|
||||||
cost += self.label != gold.c_labels[s.stack[0]]
|
cost += gold.c_heads[s.stack[0]] != s.stack[0]
|
||||||
|
# Are we labelling correctly?
|
||||||
|
cost += self.label != gold.c_labels[s.stack[0]]
|
||||||
return cost
|
return cost
|
||||||
|
|
||||||
cost += head_in_buffer(s, s.stack[0], gold.c_heads)
|
cost += head_in_buffer(s, s.stack[0], gold.c_heads)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user