* Fix slicing when start or stop is None

This commit is contained in:
Matthew Honnibal 2015-09-15 14:43:10 +10:00
parent 7ac6cacc26
commit 60c26b2dfa

View File

@ -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: