mirror of https://github.com/explosion/spaCy.git
* Make possibly dubious correction to the unshift oracle
This commit is contained in:
parent
f66228f253
commit
38a6afa484
|
@ -177,9 +177,15 @@ cdef class LeftArc:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
cdef inline int move_cost(StateClass s, const GoldParseC* gold) nogil:
|
cdef inline int move_cost(StateClass s, const GoldParseC* gold) nogil:
|
||||||
|
cdef int cost = 0
|
||||||
if arc_is_gold(gold, s.B(0), s.S(0)):
|
if arc_is_gold(gold, s.B(0), s.S(0)):
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
|
# Account for deps we might lose between S0 and stack
|
||||||
|
if not s.has_head(s.S(0)):
|
||||||
|
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 pop_cost(s, gold, s.S(0)) + arc_cost(s, gold, s.B(0), s.S(0))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue