mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
* Fix slicing when start or stop is None
This commit is contained in:
parent
7ac6cacc26
commit
60c26b2dfa
|
@ -88,6 +88,10 @@ cdef class Doc:
|
||||||
if i.step is not None:
|
if i.step is not None:
|
||||||
raise ValueError("Stepped slices not supported in Span objects."
|
raise ValueError("Stepped slices not supported in Span objects."
|
||||||
"Try: list(doc)[start:stop:step] instead.")
|
"Try: list(doc)[start:stop:step] instead.")
|
||||||
|
if i.start is None:
|
||||||
|
i.start = 0
|
||||||
|
if i.stop is None:
|
||||||
|
i.stop = len(self)
|
||||||
return Span(self, i.start, i.stop, label=0)
|
return Span(self, i.start, i.stop, label=0)
|
||||||
|
|
||||||
if i < 0:
|
if i < 0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user