spaCy/spacy/syntax/stateclass.pxd

127 lines
3.3 KiB
Cython
Raw Normal View History

from libc.string cimport memcpy, memset
from cymem.cymem cimport Pool
cimport cython
from ..structs cimport TokenC, Entity
from ..vocab cimport EMPTY_LEXEME
from ._state cimport StateC
@cython.final
cdef class StateClass:
cdef Pool mem
cdef StateC* c
@staticmethod
cdef inline StateClass init(const TokenC* sent, int length):
cdef StateClass self = StateClass(length)
self.c = new StateC(sent, length)
return self
2015-06-10 08:22:33 +03:00
cdef inline int S(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.S(i)
2015-06-10 08:22:33 +03:00
cdef inline int B(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.B(i)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* S_(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.S_(i)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* B_(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.B_(i)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* H_(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.H_(i)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* E_(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.E_(i)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* L_(self, int i, int idx) nogil:
2016-02-01 04:37:08 +03:00
return self.c.L_(i, idx)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* R_(self, int i, int idx) nogil:
2016-02-01 04:37:08 +03:00
return self.c.R_(i, idx)
2015-06-29 02:06:28 +03:00
cdef inline const TokenC* safe_get(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.safe_get(i)
2015-06-29 02:06:28 +03:00
cdef inline int H(self, int i) nogil:
return self.c.H(i)
2016-02-01 04:37:08 +03:00
cdef inline int E(self, int i) nogil:
return self.c.E(i)
2015-06-29 02:06:28 +03:00
2016-02-01 04:37:08 +03:00
cdef inline int L(self, int i, int idx) nogil:
return self.c.L(i, idx)
2015-06-29 02:06:28 +03:00
2016-02-01 04:37:08 +03:00
cdef inline int R(self, int i, int idx) nogil:
return self.c.R(i, idx)
2015-06-29 02:06:28 +03:00
cdef inline bint empty(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.empty()
2015-06-29 02:06:28 +03:00
cdef inline bint eol(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.eol()
2015-06-29 02:06:28 +03:00
cdef inline bint at_break(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.at_break()
2015-06-29 02:06:28 +03:00
cdef inline bint is_final(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.is_final()
2015-06-29 02:06:28 +03:00
cdef inline bint has_head(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.has_head(i)
2015-06-29 02:06:28 +03:00
cdef inline int n_L(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.n_L(i)
2015-06-29 02:06:28 +03:00
cdef inline int n_R(self, int i) nogil:
2016-02-01 04:37:08 +03:00
return self.c.n_R(i)
2015-06-29 02:06:28 +03:00
cdef inline bint stack_is_connected(self) nogil:
return False
2015-06-29 02:06:28 +03:00
cdef inline bint entity_is_open(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.entity_is_open()
2015-06-29 02:06:28 +03:00
cdef inline int stack_depth(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.stack_depth()
2015-06-29 02:06:28 +03:00
cdef inline int buffer_length(self) nogil:
2016-02-01 04:37:08 +03:00
return self.c.buffer_length()
2016-02-01 04:37:08 +03:00
cdef inline void push(self) nogil:
self.c.push()
2016-02-01 04:37:08 +03:00
cdef inline void pop(self) nogil:
self.c.pop()
2016-02-01 04:37:08 +03:00
cdef inline void unshift(self) nogil:
self.c.unshift()
2016-02-01 04:37:08 +03:00
cdef inline void add_arc(self, int head, int child, int label) nogil:
self.c.add_arc(head, child, label)
2016-02-01 04:37:08 +03:00
cdef inline void del_arc(self, int head, int child) nogil:
self.c.del_arc(head, child)
2016-02-01 04:37:08 +03:00
cdef inline void open_ent(self, int label) nogil:
self.c.open_ent(label)
2016-02-01 04:37:08 +03:00
cdef inline void close_ent(self) nogil:
self.c.close_ent()
2016-02-01 04:37:08 +03:00
cdef inline void set_ent_tag(self, int i, int ent_iob, int ent_type) nogil:
self.c.set_ent_tag(i, ent_iob, ent_type)
2016-02-01 04:37:08 +03:00
cdef inline void set_break(self, int i) nogil:
self.c.set_break(i)
2016-02-01 04:37:08 +03:00
cdef inline void clone(self, StateClass src) nogil:
self.c.clone(src.c)
2016-02-01 04:37:08 +03:00
cdef inline void fast_forward(self) nogil:
self.c.fast_forward()