mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-30 20:06:30 +03:00
f277bfdf0f
* Draft out initial Spans data structure * Initial span group commit * Basic span group support on Doc * Basic test for span group * Compile span_group.pyx * Draft addition of SpanGroup to DocBin * Add deserialization for SpanGroup * Add tests for serializing SpanGroup * Fix serialization of SpanGroup * Add EdgeC and GraphC structs * Add draft Graph data structure * Compile graph * More work on Graph * Update GraphC * Upd graph * Fix walk functions * Let Graph take nodes and edges on construction * Fix walking and getting * Add graph tests * Fix import * Add module with the SpanGroups dict thingy * Update test * Rename 'span_groups' attribute * Try to fix c++11 compilation * Fix test * Update DocBin * Try to fix compilation * Try to fix graph * Improve SpanGroup docstrings * Add doc.spans to documentation * Fix serialization * Tidy up and add docs * Update docs [ci skip] * Add SpanGroup.has_overlap * WIP updated Graph API * Start testing new Graph API * Update Graph tests * Update Graph * Add docstring Co-authored-by: Ines Montani <ines@ines.io>
26 lines
521 B
Cython
26 lines
521 B
Cython
cimport numpy as np
|
|
|
|
from .doc cimport Doc
|
|
from ..typedefs cimport attr_t
|
|
from ..structs cimport SpanC
|
|
|
|
|
|
cdef class Span:
|
|
cdef readonly Doc doc
|
|
cdef SpanC c
|
|
cdef public _vector
|
|
cdef public _vector_norm
|
|
|
|
@staticmethod
|
|
cdef inline Span cinit(Doc doc, SpanC span):
|
|
cdef Span self = Span.__new__(
|
|
Span,
|
|
doc,
|
|
start=span.start,
|
|
end=span.end
|
|
)
|
|
self.c = span
|
|
return self
|
|
|
|
cpdef np.ndarray to_array(self, object features)
|