spaCy/spacy/tokens/span.pxd

29 lines
632 B
Cython
Raw Normal View History

from libcpp.memory cimport shared_ptr
cimport numpy as np
from .doc cimport Doc
2017-05-28 19:09:27 +03:00
from ..typedefs cimport attr_t
from ..structs cimport SpanC
cdef class Span:
2015-09-29 16:03:55 +03:00
cdef readonly Doc doc
cdef shared_ptr[SpanC] c
cdef public _vector
cdef public _vector_norm
@staticmethod
cdef inline Span cinit(Doc doc, const shared_ptr[SpanC] &span):
cdef Span self = Span.__new__(
Span,
doc,
start=span.get().start,
end=span.get().end
)
self.c = span
return self
2017-08-19 13:20:45 +03:00
cpdef np.ndarray to_array(self, object features)
cdef SpanC* span_c(self)