* Fix negative index for __getitem__

This commit is contained in:
Matthew Honnibal 2015-02-07 12:58:46 -05:00
parent ef795aece8
commit ab8bb047d0

View File

@ -102,7 +102,7 @@ cdef class Tokens:
token (Token): token (Token):
""" """
if i < 0: if i < 0:
i = self.length - i i = self.length + i
bounds_check(i, self.length, PADDING) bounds_check(i, self.length, PADDING)
return Token.cinit(self.vocab, self._string, return Token.cinit(self.vocab, self._string,
&self.data[i], i, self.length, &self.data[i], i, self.length,