mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-28 10:56:31 +03:00
* Inline B and S methods on stateclass
This commit is contained in:
parent
e2f9a80713
commit
abd07c067a
|
@ -28,8 +28,15 @@ cdef class StateClass:
|
||||||
self._buffer[i] = i
|
self._buffer[i] = i
|
||||||
return self
|
return self
|
||||||
|
|
||||||
cdef int S(self, int i) nogil
|
cdef inline int S(self, int i) nogil:
|
||||||
cdef int B(self, int i) nogil
|
if i >= self._s_i:
|
||||||
|
return -1
|
||||||
|
return self._stack[self._s_i - (i+1)]
|
||||||
|
|
||||||
|
cdef inline int B(self, int i) nogil:
|
||||||
|
if (i + self._b_i) >= self.length:
|
||||||
|
return -1
|
||||||
|
return self._buffer[self._b_i + i]
|
||||||
|
|
||||||
cdef int H(self, int i) nogil
|
cdef int H(self, int i) nogil
|
||||||
cdef int E(self, int i) nogil
|
cdef int E(self, int i) nogil
|
||||||
|
|
|
@ -21,16 +21,6 @@ cdef class StateClass:
|
||||||
self._buffer[i] = i
|
self._buffer[i] = i
|
||||||
self._empty_token.lex = &EMPTY_LEXEME
|
self._empty_token.lex = &EMPTY_LEXEME
|
||||||
|
|
||||||
cdef int S(self, int i) nogil:
|
|
||||||
if i >= self._s_i:
|
|
||||||
return -1
|
|
||||||
return self._stack[self._s_i - (i+1)]
|
|
||||||
|
|
||||||
cdef int B(self, int i) nogil:
|
|
||||||
if (i + self._b_i) >= self.length:
|
|
||||||
return -1
|
|
||||||
return self._buffer[self._b_i + i]
|
|
||||||
|
|
||||||
cdef int H(self, int i) nogil:
|
cdef int H(self, int i) nogil:
|
||||||
if i < 0 or i >= self.length:
|
if i < 0 or i >= self.length:
|
||||||
return -1
|
return -1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user