Fix transition has_gold

This commit is contained in:
Matthew Honnibal 2021-01-25 16:48:45 +11:00
parent b2044d510e
commit bd04ea0b02
2 changed files with 4 additions and 0 deletions

View File

@ -757,6 +757,8 @@ cdef class ArcEager(TransitionSystem):
return list(arcs)
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]:
if word.dep != 0:
return True

View File

@ -266,6 +266,8 @@ cdef class BiluoPushDown(TransitionSystem):
return BiluoGold(self, state, example)
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]:
if word.ent_iob != 0:
return True