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 should accept string label #3027

Closed
ines opened this issue Dec 8, 2018 · 1 comment
Closed

💫 Span should accept string label #3027

ines opened this issue Dec 8, 2018 · 1 comment
Labels
enhancement Feature requests and improvements feat / doc Feature: Doc, Span and Token objects

Comments

@ines
Copy link
Member

ines commented Dec 8, 2018

The Span class allows a label= keyword argument, but only accepts integer IDs (hash values), not string labels. So in order to add a string label, you first need to look it up in the nlp.vocab.strings or doc.vocab.strings. This is inconvenient – ideally, Span should accept both:

+ span = Span(doc, start, end, label=nlp.vocab.strings['SOME_LABEL'])
+ span = Span(doc, start, end, label='SOME_LABEL')
@ines ines added enhancement Feature requests and improvements feat / doc Feature: Doc, Span and Token objects labels Dec 8, 2018
honnibal added a commit that referenced this issue Dec 8, 2018
ines pushed a commit that referenced this issue Dec 8, 2018
Fixes #3027.

* Allow Span.__init__ to take unicode values for the `label` argument.
* Allow `Span.label_` to be writeable.

- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [ ] My changes don't require a change to the documentation, or if they do, I've added all required information.
@ines ines closed this as completed Dec 8, 2018
@lock
Copy link

lock bot commented Jan 7, 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 Jan 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Feature requests and improvements feat / doc Feature: Doc, Span and Token objects
Projects
None yet
Development

No branches or pull requests

1 participant