* Fix bug in token subtree, introduced by duplication of L/R code in Stateclass. Need to consolidate the two methods.

This commit is contained in:
Matthew Honnibal 2015-09-06 10:48:36 +02:00
parent 571b6eda88
commit 7e4fea67d3
1 changed files with 2 additions and 2 deletions

View File

@ -142,7 +142,7 @@ cdef class Token:
"""The leftward immediate children of the word, in the syntactic """The leftward immediate children of the word, in the syntactic
dependency parse. dependency parse.
""" """
cdef const TokenC* ptr = self.c - self.i cdef const TokenC* ptr = self.c - (self.i - self.c.l_edge)
while ptr < self.c: while ptr < self.c:
# If this head is still to the right of us, we can skip to it # If this head is still to the right of us, we can skip to it
# No token that's between this token and this head could be our # No token that's between this token and this head could be our
@ -160,7 +160,7 @@ cdef class Token:
def __get__(self): def __get__(self):
"""The rightward immediate children of the word, in the syntactic """The rightward immediate children of the word, in the syntactic
dependency parse.""" dependency parse."""
cdef const TokenC* ptr = (self.c - self.i) + (self.array_len - 1) cdef const TokenC* ptr = self.c + (self.c.r_edge - self.i)
tokens = [] tokens = []
while ptr > self.c: while ptr > self.c:
# If this head is still to the right of us, we can skip to it # If this head is still to the right of us, we can skip to it