Account for differences between Span.sents in spaCy 3/4

This commit is contained in:
Daniël de Kok 2023-06-22 15:38:22 +02:00
parent 4990cfefb4
commit 096794dd74

View File

@ -495,11 +495,12 @@ cdef class Span:
if start >= self.end:
break
elif i == self.doc.length - 1:
yield Span(self.doc, start, self.doc.length)
spans.append(Span(self.doc, start, self.doc.length))
# Ensure that trailing parts of the Span instance are included in last element of .sents.
if start == self.doc.length - 1:
yield Span(self.doc, start, self.doc.length)
spans.append(Span(self.doc, start, self.doc.length))
return tuple(spans)
@property
def ents(self):