spaCyTextBlob is a pipeline component that enables sentiment analysis using the TextBlob library. It will add the additional extenstion
import spacy from spacytextblob.spacytextblob import SpacyTextBlob nlp = spacy.load('en_core_web_sm') spacy_text_blob = SpacyTextBlob() nlp.add_pipe(spacy_text_blob) 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._.sentiment.polarity # Polarity: -0.125 doc._.sentiment.subjectivity # Sujectivity: 0.9 doc._.sentiment.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)]
Submit your project
If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the
project idea label on the issue tracker.