From ab694b03646b798cc36a0d205963bd13a82d1b95 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 29 Sep 2015 23:03:09 +1000 Subject: [PATCH] * Fix open-bounded slice indices. --- spacy/tokens/doc.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index 536b3582b..8a7d12555 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -91,9 +91,9 @@ cdef class Doc: raise ValueError("Stepped slices not supported in Span objects." "Try: list(doc)[start:stop:step] instead.") if i.start is None: - i.start = 0 + i = slice(0, i.stop) if i.stop is None: - i.stop = len(self) + i = slice(i.start, len(self)) return Span(self, i.start, i.stop, label=0) if i < 0: