Skip to content

Can't retrieve unregistered extension attribute 'blob'.  #19

Description

@dsm-72

Copy pasted from tutorial

import spacy
from spacytextblob.spacytextblob import SpacyTextBlob

nlp = spacy.load('en_core_web_sm')
nlp.add_pipe('spacytextblob')
text = 'I had a really horrible day. It was the worst day ever! But every now and then I have a really good day that makes me happy.'
doc = nlp(text)
doc._.blob.polarity                            # Polarity: -0.125
doc._.blob.subjectivity                        # Subjectivity: 0.9
doc._.blob.sentiment_assessments.assessments   # Assessments: [(['really', 'horrible'], -1.0, 1.0, None), (['worst', '!'], -1.0, 1.0, None), (['really', 'good'], 0.7, 0.6000000000000001, None), (['happy'], 0.8, 1.0, None)]
doc._.blob.ngrams() 
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-30-b84122143817> in <module>
      6 text = 'I had a really horrible day. It was the worst day ever! But every now and then I have a really good day that makes me happy.'
      7 doc = nlp(text)
----> 8 doc._.blob.polarity                            # Polarity: -0.125
      9 doc._.blob.subjectivity                        # Subjectivity: 0.9
     10 doc._.blob.sentiment_assessments.assessments   # Assessments: [(['really', 'horrible'], -1.0, 1.0, None), (['worst', '!'], -1.0, 1.0, None), (['really', 'good'], 0.7, 0.6000000000000001, None), (['happy'], 0.8, 1.0, None)]

/opt/anaconda/anaconda3/envs/venv/lib/python3.6/site-packages/spacy/tokens/underscore.py in __getattr__(self, name)
     45     def __getattr__(self, name: str) -> Any:
     46         if name not in self._extensions:
---> 47             raise AttributeError(Errors.E046.format(name=name))
     48         default, method, getter, setter = self._extensions[name]
     49         if getter is not None:

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions