diff --git a/spacy/syntax/stateclass.pyx b/spacy/syntax/stateclass.pyx index c4a41ff73..2ce87c79a 100644 --- a/spacy/syntax/stateclass.pyx +++ b/spacy/syntax/stateclass.pyx @@ -52,7 +52,7 @@ cdef class StateClass: cdef const TokenC* target = &self._sent[i] if target.l_kids < idx: return -1 - cdef const TokenC* ptr = self._sent + cdef const TokenC* ptr = &self._sent[target.l_edge] while ptr < target: # If this head is still to the right of us, we can skip to it @@ -78,7 +78,7 @@ cdef class StateClass: cdef const TokenC* target = &self._sent[i] if target.r_kids < idx: return -1 - cdef const TokenC* ptr = self._sent + (self.length - 1) + cdef const TokenC* ptr = &self._sent[target.r_edge] while ptr > target: # 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