mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
Fix array out of bounds error in Span
This commit is contained in:
parent
aff5f007b3
commit
a1be01185c
|
@ -294,6 +294,7 @@ cdef class Span:
|
|||
cdef int i
|
||||
if self.doc.is_parsed:
|
||||
root = &self.doc.c[self.start]
|
||||
n = 0
|
||||
while root.head != 0:
|
||||
root += root.head
|
||||
n += 1
|
||||
|
@ -307,8 +308,10 @@ cdef class Span:
|
|||
start += -1
|
||||
# find end of the sentence
|
||||
end = self.end
|
||||
while self.doc.c[end].sent_start != 1:
|
||||
n = 0
|
||||
while end < self.doc.length and self.doc.c[end].sent_start != 1:
|
||||
end += 1
|
||||
n += 1
|
||||
if n >= self.doc.length:
|
||||
break
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue
Block a user