mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
Account for differences between Span.sents in spaCy 3/4
This commit is contained in:
parent
4990cfefb4
commit
096794dd74
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user