You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importspacyfromspacytextblob.spacytextblobimportSpacyTextBlobnlp=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.125doc._.blob.subjectivity# Subjectivity: 0.9doc._.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?
The text was updated successfully, but these errors were encountered:
Copy pasted from tutorial
The text was updated successfully, but these errors were encountered: