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

AttributeError: 'spacy.tokens.token.Token' object has no attribute 'label_' #1131

Closed
satjaydepdar opened this issue Jun 14, 2017 · 9 comments
Labels
usage General spaCy usage

Comments

@satjaydepdar
Copy link

satjaydepdar commented Jun 14, 2017

Hi,

I am learning Spacy for named entity extraction for my project. To practice, I am used the code written by Honnibal at #665. But I am getting the error reproduced below:

for ent in doc:
... print(ent.text, ent.label_)
...
Traceback (most recent call last):
File "", line 2, in
AttributeError: 'spacy.tokens.token.Token' object has no attribute 'label_'

Please help to resolve the issue.

I am using:

  • Python Version Used: 2.7
  • spaCy Version Used: 1.8.0

Thanks
tellsathish

@Liebeck
Copy link

Liebeck commented Jun 14, 2017

Have you tried using ent_type_ ? This might also be helpful: https://spacy.io/docs/api/token

@honnibal
Copy link
Member

I think the snipper of code I gave is wrong -- it should be for ent in doc.ents. Sorry!

@honnibal honnibal added the usage General spaCy usage label Jun 15, 2017
@satjaydepdar
Copy link
Author

@honnibal

Thanks for the correction. It is working now.
@Liebeck , thanks for your response. The link you had provided helped to learn deeper about Spacy.

I am working on use case for automating ticket resolution for our ITSM (IT service management). the first step is to disambiguate words in the tickets we receive. For example "Install MySQL in my system". I want to annotate the text like [Install:Action/MySQL:Software/System:machine] and parse this further to a format I wanted by adding more details about the machine which I will get from Knowledge-base, which is a graph. The parameters will be sent to RPA tool for resolving the request.

I just want to know if I can use my own vocabulary/taxonomy in Spacy for this use case. If yes, can you give me some pointers how to go about it? Meanwhile, I will do my own research with Spacy.

Thanks,
Sathish PV

@Liebeck
Copy link

Liebeck commented Jun 16, 2017

Your usage scenario reminds me a lot of the current developments on bot frameworks, namely automatically identifying the user intent. For instance, Microsoft offers a trainable intent mechanism inside LUIS (https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-recognize-intent)
I hope this helps ;)

@satjaydepdar
Copy link
Author

@Liebeck
Thanks so much. I will explore LUIS further.
Can Spacy be used for the use case? Thought?

Thanks
Sathish PV

@Liebeck
Copy link

Liebeck commented Jun 16, 2017

@satjaydepdar As far as my knowledge about spaCy goes, I'd say that spaCy can definetly be used as a part of what you have planned. I guess some things need to be stacked on top of spaCy. Custom taxonomy should be possible with the custom annotation pipeline components introduced in v2.0 or after you have used spaCy to process your texts.

@f11r
Copy link
Contributor

f11r commented Jun 16, 2017

Check out rasa (https://github.com/RasaHQ/rasa_nlu, https://rasa.ai/), an open-source alternative to luis in part build on spacy.

@satjaydepdar
Copy link
Author

@Liebeck

I went through the rasa.ai contents. I am getting hope that it will help to solve my use case. I will work on it more this week-end. Thanks for pointing me to the tool.

Thanks
Sathish PV

@ines ines closed this as completed Oct 16, 2017
@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
usage General spaCy usage
Projects
None yet
Development

No branches or pull requests

5 participants