* Fix padding on tokens

This commit is contained in:
Matthew Honnibal 2014-10-23 04:01:17 +11:00
parent 96b835a3d4
commit 7baef5b7ff

View File

@ -49,9 +49,8 @@ cdef class Tokens:
self.lex = self._lex_ptr self.lex = self._lex_ptr
self.idx = self._idx_ptr self.idx = self._idx_ptr
self.pos = self._pos_ptr self.pos = self._pos_ptr
for i in range(PADDING): cdef int i
self.lex[i] = &EMPTY_LEXEME for i in range(size + (PADDING*2)):
for i in range(size, PADDING):
self.lex[i] = &EMPTY_LEXEME self.lex[i] = &EMPTY_LEXEME
self.lex += PADDING self.lex += PADDING
self.idx += PADDING self.idx += PADDING
@ -85,7 +84,8 @@ cdef class Tokens:
self.lex = self._lex_ptr + PADDING self.lex = self._lex_ptr + PADDING
self.idx = self._idx_ptr + PADDING self.idx = self._idx_ptr + PADDING
self.pos = self._pos_ptr + PADDING self.pos = self._pos_ptr + PADDING
for i in range(self.length, self.max_length + PADDING):
self.lex[i] = &EMPTY_LEXEME
cdef int extend(self, int idx, LexemeC** lexemes, int n) except -1: cdef int extend(self, int idx, LexemeC** lexemes, int n) except -1:
cdef int i cdef int i