Skip to content

Pickling/Unpickling a doc does work #606

@halfak

Description

@halfak

Spacy docs can't be pickle and unpickled.

$ python
Python 3.5.1+ (default, Mar 30 2016, 22:46:26) 
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> from spacy.en import English
>>> parse = English()
>>> doc = parse("I'm a little teapot")
>>> pickled_doc = pickle.loads(pickle.dumps(doc))
>>> doc
I'm a little teapot
>>> pickled_doc

>>> doc == pickled_doc
False
>>> repr(pickled_doc)
''
>>> type(pickled_doc)
<class 'spacy.tokens.doc.Doc'>
$ pip freeze | grep spacy
spacy==0.101.0

Your Environment

  • Operating System: Ubuntu
  • Python Version Used: 3.5.1
  • spaCy Version Used: 0.101.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature requests and improvements🌙 nightlyDiscussion and contributions related to nightly builds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions