SamEdwardes / spacytextblob

A TextBlob sentiment analysis pipeline component for spaCy.
https://spacytextblob.netlify.app/
MIT License
55 stars 8 forks source link

AttributeError: [E046] Can't retrieve unregistered extension attribute 'sentiment'. Did you forget to call the `set_extension` method? #12

Closed progenysw closed 3 years ago

progenysw commented 3 years ago

hi,looks like it works for space3 now, thank you. however getting the above error

1 - looks like spacytextblob pipeline is registered

2 - this is my code

nlp = spacy.load("en_core_web_sm") nlp.add_pipe("spacytextblob")

not this is NOT the last pipe doc = nlp(summaryOfenquiry) def analyseSentiment(app,doc): app.logger('Assessments:', doc._.sentiment.assessments) return 1
what have i missed?

jcarlen commented 3 years ago

I had a similar error with doc._.sentiment.subjectivity and had to update to doc._.subjectivity.

progenysw commented 3 years ago

that did it, thank you

SamEdwardes commented 3 years ago

Thank you for providing the fix @jcarlen. Apologies there was an issue in the documentation. It has now been updated in #10 and #11.