Skip to content
Discussion options

You must be logged in to vote

I get what you're trying to do, but as far as I know the Doc.set_extension doesn't support to_bytes or from_bytes arguments - where did you get that example code from?

In general, Doc objects can be serialized with custom attributes, if those attributes are of a type that srsly.msgpack._packer supports.

To step back a bit - wouldn't it be easier for your use-case to store these special spans on the Doc's built spans structure?

doc.spans["special_spans"] = [doc[0:2], doc[4:6]]

This should serialize just fine.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by svlandeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / serialize Feature: Serialization, saving and loading feat / doc Feature: Doc, Span and Token objects
2 participants
Converted from issue

This discussion was converted from issue #13281 on February 06, 2024 11:12.