mirror of https://github.com/explosion/spaCy.git
* Improve efficiency of L and R features, correcting the non-linear-in-length problem.
This commit is contained in:
parent
70d2acb579
commit
55f1042443
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue