Can't retrieve unregistered extension attribute 'blob'. #10439
-
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?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
spaCy Universe is a directory of third-party components. We don't maintain the code listed there, we just provide a list of things for convenience. If you read the actual tutorial, you need to install data first. For further questions you should ask at the spaCy textblob repo. |
Beta Was this translation helpful? Give feedback.
-
I don't know why,
Looks like the .blob is in the ._ instead of where it's expected to be |
Beta Was this translation helpful? Give feedback.
spaCy Universe is a directory of third-party components. We don't maintain the code listed there, we just provide a list of things for convenience.
If you read the actual tutorial, you need to install data first.
For further questions you should ask at the spaCy textblob repo.