From 55f1042443b15de501da94006a83e227bb3c8811 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 9 Jul 2015 12:17:26 +0200 Subject: [PATCH] * Improve efficiency of L and R features, correcting the non-linear-in-length problem. --- spacy/syntax/stateclass.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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