diff --git a/spacy/tokens/_dict_proxies.py b/spacy/tokens/_dict_proxies.py index b10f6d484..bfc867ffa 100644 --- a/spacy/tokens/_dict_proxies.py +++ b/spacy/tokens/_dict_proxies.py @@ -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.