mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-30 19:24:07 +03:00
Fix transition has_gold
This commit is contained in:
parent
b2044d510e
commit
bd04ea0b02
|
@ -757,6 +757,8 @@ cdef class ArcEager(TransitionSystem):
|
||||||
return list(arcs)
|
return list(arcs)
|
||||||
|
|
||||||
def has_gold(self, Example eg, start=0, end=None):
|
def has_gold(self, Example eg, start=0, end=None):
|
||||||
|
if end is not None and end < 0:
|
||||||
|
end = None
|
||||||
for word in eg.y[start:end]:
|
for word in eg.y[start:end]:
|
||||||
if word.dep != 0:
|
if word.dep != 0:
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -266,6 +266,8 @@ cdef class BiluoPushDown(TransitionSystem):
|
||||||
return BiluoGold(self, state, example)
|
return BiluoGold(self, state, example)
|
||||||
|
|
||||||
def has_gold(self, Example eg, start=0, end=None):
|
def has_gold(self, Example eg, start=0, end=None):
|
||||||
|
if end is not None and end < 0:
|
||||||
|
end = None
|
||||||
for word in eg.y[start:end]:
|
for word in eg.y[start:end]:
|
||||||
if word.ent_iob != 0:
|
if word.ent_iob != 0:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user