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

Span Merge with keyword arguments #1240

Closed
daniter-cu opened this issue Aug 2, 2017 · 4 comments
Closed

Span Merge with keyword arguments #1240

daniter-cu opened this issue Aug 2, 2017 · 4 comments
Labels
bug Bugs and behaviour differing from documentation

Comments

@daniter-cu
Copy link

Merging spans with keyword arguments does not work.

Looking at

lemma = self.vocab.strings[attributes.get(LEMMA, span.root.lemma)]

if you want to use a keyword argument to set the lemma, you have to use the key attrs.LEMMA. However, the value of that is 73. Python does not allow numeric keys and putting the key into a dict and using the ** operator (eg myspan.merge(**{spacy.attrs.LEMMA:"new_lemma"}) throws a type error.

Your Environment

  • Python version: 2.7.10
  • Platform: Darwin-16.6.0-x86_64-i386-64bit
  • spaCy version: 1.8.2
  • Installed models: en, en_core_web_md
@honnibal
Copy link
Member

honnibal commented Aug 3, 2017

This is fixed in 2.0 (on develop branch). If you want you could port the fix over? It doesn't rely on other changes.

@honnibal honnibal added the bug Bugs and behaviour differing from documentation label Aug 3, 2017
@daniter-cu
Copy link
Author

Thanks for the quick response! It's not a big issue so I won't bother porting the fix. Using the three parameters interface (which I guess will be deprecated soon) is a workaround for now. I can switch to keyword args when I update to 2.0.

@honnibal
Copy link
Member

honnibal commented Aug 4, 2017

Okay cool. Thanks, and please keep reporting! :)

@lock
Copy link

lock bot commented May 8, 2018

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 May 8, 2018
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
Projects
None yet
Development

No branches or pull requests

2 participants