A TextBlob sentiment analysis pipeline compponent for spaCy
Project description
spaCyTextBlob
A TextBlob sentiment analysis pipeline compponent for spaCy.
Table of Contents
Install
Install spaCyTextBlob from pypi.
pip install spacytextblob
TextBlob also requires some data to be downloaded before getting started.
python -m textblob.download_corpora
spaCy requires that you download a model to get started.
python -m spacy download en_core_web_sm
Quick Start
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)
print('Polarity:', doc._.polarity)
Polarity: -0.125
print('Sujectivity:', doc._.subjectivity)
Sujectivity: 0.9
print('Assessments:', doc._.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)]
Reference and Attribution
- TextBlob
- negspaCy (for inpiration in writing pipeline and organizing repo)
- spaCy custom components
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spacytextblob-0.1.5.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for spacytextblob-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55bfddbcdf5396d1bdc6d7a19c7c9bd7498dff68d16ea1dd8d75a05d3740104c |
|
MD5 | 9e2f723d40c9d117ec22261269eaa142 |
|
BLAKE2b-256 | 9f4beb02e9861faf455ede372df61d096a7e0a91be8e78bb3d0da892f001d7f9 |