* Bug fixes to parse navigation

This commit is contained in:
Matthew Honnibal 2015-01-31 16:37:13 +11:00
parent e013555b25
commit 018e0bfa24
2 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ cdef class Token:
cdef unicode _string cdef unicode _string
cdef const TokenC* c cdef const TokenC* c
cdef int i cdef readonly int i
cdef int array_len cdef int array_len

View File

@ -344,7 +344,7 @@ cdef class Token:
elif ptr + ptr.head == self.c: elif ptr + ptr.head == self.c:
yield Token.cinit(self.mem, self.vocab, self._string, yield Token.cinit(self.mem, self.vocab, self._string,
ptr, self.i, self.array_len, ptr, ptr - (self.c - self.i), self.array_len,
self._py, self._tag_strings, self._dep_strings) self._py, self._tag_strings, self._dep_strings)
ptr += 1 ptr += 1
else: else:
@ -363,7 +363,7 @@ cdef class Token:
ptr += ptr.head ptr += ptr.head
elif ptr + ptr.head == self.c: elif ptr + ptr.head == self.c:
yield Token.cinit(self.mem, self.vocab, self._string, yield Token.cinit(self.mem, self.vocab, self._string,
ptr, self.i, self.array_len, ptr, ptr - (self.c - self.i), self.array_len,
self._py, self._tag_strings, self._dep_strings) self._py, self._tag_strings, self._dep_strings)
ptr -= 1 ptr -= 1
else: else:
@ -373,7 +373,7 @@ cdef class Token:
def head(self): def head(self):
"""The token predicted by the parser to be the head of the current token.""" """The token predicted by the parser to be the head of the current token."""
return Token.cinit(self.mem, self.vocab, self._string, return Token.cinit(self.mem, self.vocab, self._string,
self.c + self.c.head, self.i, self.array_len, self.c + self.c.head, self.i + self.c.head, self.array_len,
self._py, self._tag_strings, self._dep_strings) self._py, self._tag_strings, self._dep_strings)
@property @property