mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 10:26:35 +03:00
Add SpanGroups.copy method
This commit is contained in:
parent
8a22161b59
commit
492c948937
|
@ -33,6 +33,9 @@ class SpanGroups(UserDict):
|
|||
def _make_span_group(self, name: str, spans: Iterable["Span"]) -> SpanGroup:
|
||||
return SpanGroup(self.doc_ref(), name=name, spans=spans)
|
||||
|
||||
def copy(self) -> "SpanGroups":
|
||||
return SpanGroup(self.doc_ref()).from_bytes(self.to_bytes())
|
||||
|
||||
def to_bytes(self) -> bytes:
|
||||
# We don't need to serialize this as a dict, because the groups
|
||||
# know their names.
|
||||
|
|
Loading…
Reference in New Issue
Block a user