mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-14 13:47:13 +03:00
604a7c3c26
* `SpanGroup`: Add support for binding copies to a new reference document * `SpanGroups`: Replace superfluous serialize-deserialize roundtrip in `copy` Instead, directly copy the in-memory representations of the constituent `SpanGroup`s. * Update `SpanGroup.copy()` signature * Rename `new_doc` param to `doc` * Fix kwdarg * Update `.pyi` file and docstrings * `mypy` fix * Update spacy/tokens/span_group.pyx * Update docs Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
28 lines
807 B
Python
28 lines
807 B
Python
from typing import Any, Dict, Iterable, Optional
|
|
from .doc import Doc
|
|
from .span import Span
|
|
|
|
class SpanGroup:
|
|
name: str
|
|
attrs: Dict[str, Any]
|
|
def __init__(
|
|
self,
|
|
doc: Doc,
|
|
*,
|
|
name: str = ...,
|
|
attrs: Dict[str, Any] = ...,
|
|
spans: Iterable[Span] = ...
|
|
) -> None: ...
|
|
def __repr__(self) -> str: ...
|
|
@property
|
|
def doc(self) -> Doc: ...
|
|
@property
|
|
def has_overlap(self) -> bool: ...
|
|
def __len__(self) -> int: ...
|
|
def append(self, span: Span) -> None: ...
|
|
def extend(self, spans: Iterable[Span]) -> None: ...
|
|
def __getitem__(self, i: int) -> Span: ...
|
|
def to_bytes(self) -> bytes: ...
|
|
def from_bytes(self, bytes_data: bytes) -> SpanGroup: ...
|
|
def copy(self, doc: Optional[Doc] = ...) -> SpanGroup: ...
|