mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-13 02:36:32 +03:00
* Bug fixes to parse navigation
This commit is contained in:
parent
e013555b25
commit
018e0bfa24
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user