Skip to content

Commit bd04ea0

Browse files
committed
Fix transition has_gold
1 parent b2044d5 commit bd04ea0

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

spacy/pipeline/_parser_internals/arc_eager.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ cdef class ArcEager(TransitionSystem):
757757
return list(arcs)
758758

759759
def has_gold(self, Example eg, start=0, end=None):
760+
if end is not None and end < 0:
761+
end = None
760762
for word in eg.y[start:end]:
761763
if word.dep != 0:
762764
return True

spacy/pipeline/_parser_internals/ner.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ cdef class BiluoPushDown(TransitionSystem):
266266
return BiluoGold(self, state, example)
267267

268268
def has_gold(self, Example eg, start=0, end=None):
269+
if end is not None and end < 0:
270+
end = None
269271
for word in eg.y[start:end]:
270272
if word.ent_iob != 0:
271273
return True

0 commit comments

Comments
 (0)