Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified pos attribute not being serialized #3959

Closed
aabbi opened this issue Jul 12, 2019 · 2 comments
Closed

Modified pos attribute not being serialized #3959

aabbi opened this issue Jul 12, 2019 · 2 comments
Labels
bug Bugs and behaviour differing from documentation feat / doc Feature: Doc, Span and Token objects feat / serialize Feature: Serialization, saving and loading

Comments

@aabbi
Copy link

aabbi commented Jul 12, 2019

How to reproduce the behaviour

Since pos attribute of tokens is now writable (related comment ), I ran into the issue that I changed the pos tag and serialized the doc but on deserializing, it retained the original pos tag.
I believe this is happening because only the tag attributes are pickled

import spacy
nlp = spacy.load('en')
d = nlp("displaCy uses JavaScript, SVG and CSS to show you how computers understand language")
print(d[0].pos_) # prints ADJ
d[0].pos_ = "NOUN"
d.to_disk("t.txt")

d2 = nlp("")
d2.from_disk("t.txt")
print(d2[0].pos_) # prints ADJ

Wasn't entirely sure if this should be a bug or a feature request to make pos tags picklable or maybe documentation could be added specifying how serializing would not save changes in coarse grained attributes with pos tag as examples

Your Environment

  • spaCy version: 2.1.3
  • Platform: Ubuntu-14.04-trusty
  • Python version: 3.6.8
  • Models: en_core_web_lg, en, en_core_web_md
@ines ines added bug Bugs and behaviour differing from documentation feat / doc Feature: Doc, Span and Token objects feat / serialize Feature: Serialization, saving and loading labels Jul 12, 2019
@svlandeg
Copy link
Member

svlandeg commented Aug 6, 2019

Thanks for the report, good catch! Fixed in PR #4092.

@lock
Copy link

lock bot commented Sep 19, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation feat / doc Feature: Doc, Span and Token objects feat / serialize Feature: Serialization, saving and loading
Projects
None yet
Development

No branches or pull requests

4 participants