Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
spacy / pipeline / _parser_internals / stateclass.pxd
Size: Mime:
from cymem.cymem cimport Pool

from ...structs cimport TokenC, SpanC
from ...typedefs cimport attr_t
from ...tokens.doc cimport Doc

from ._state cimport StateC


cdef class StateClass:
    cdef StateC* c
    cdef readonly Doc doc
    cdef int _borrowed

    @staticmethod
    cdef inline StateClass borrow(StateC* ptr, Doc doc):
        cdef StateClass self = StateClass()
        self.c = ptr
        self._borrowed = 1
        self.doc = doc
        return self

    @staticmethod
    cdef inline StateClass init_offset(const TokenC* sent, int length, int
                                       offset):
        cdef StateClass self = StateClass()
        self.c = new StateC(sent, length)
        self.c.offset = offset
        return self