mirror of
https://github.com/explosion/spaCy.git
synced 2025-06-29 01:13:17 +03:00
* Remove from_struct method from StateClass
This commit is contained in:
parent
18cc326dc0
commit
e9aaecc619
|
@ -4,8 +4,6 @@ from cymem.cymem cimport Pool
|
||||||
|
|
||||||
from ..structs cimport TokenC, Entity
|
from ..structs cimport TokenC, Entity
|
||||||
|
|
||||||
from ._state cimport State
|
|
||||||
|
|
||||||
from ..vocab cimport EMPTY_LEXEME
|
from ..vocab cimport EMPTY_LEXEME
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,8 +28,6 @@ cdef class StateClass:
|
||||||
self._buffer[i] = i
|
self._buffer[i] = i
|
||||||
return self
|
return self
|
||||||
|
|
||||||
cdef int from_struct(self, const State* state) except -1
|
|
||||||
|
|
||||||
cdef int S(self, int i) nogil
|
cdef int S(self, int i) nogil
|
||||||
cdef int B(self, int i) nogil
|
cdef int B(self, int i) nogil
|
||||||
|
|
||||||
|
@ -90,5 +86,3 @@ cdef class StateClass:
|
||||||
cdef void set_sent_end(self, int i) nogil
|
cdef void set_sent_end(self, int i) nogil
|
||||||
|
|
||||||
cdef void clone(self, StateClass src) nogil
|
cdef void clone(self, StateClass src) nogil
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,17 +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 from_struct(self, const State* state) except -1:
|
|
||||||
self._s_i = state.stack_len
|
|
||||||
self._b_i = state.i
|
|
||||||
self._e_i = state.ents_len
|
|
||||||
memcpy(self._sent, state.sent, sizeof(TokenC) * self.length)
|
|
||||||
cdef int i
|
|
||||||
for i in range(state.stack_len):
|
|
||||||
self._stack[self._s_i - (i+1)] = state.stack[-i]
|
|
||||||
for i in range(state.ents_len):
|
|
||||||
self._ents[i] = state.ent[-i]
|
|
||||||
|
|
||||||
cdef int S(self, int i) nogil:
|
cdef int S(self, int i) nogil:
|
||||||
if i >= self._s_i:
|
if i >= self._s_i:
|
||||||
return -1
|
return -1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user