A python package for flexible and transparent sentiment analysis.
Project description
Asent: Fast, flexible and transparent sentiment analysis
Asent is a rule-based sentiment analysis library for Python made using SpaCy. It is inspired by Vader, but uses a more modular ruleset, that allows the user to change e.g. the method for finding negations. Furthermore, it includes visualizers to visualize model predictions, making the model easily interpretable.
Installation
Installing Asent is simple using pip:
pip install asent
There is no reason to update from GitHub as the version on pypi should always be the same of on GitHub.
Simple Example
The following shows a simple example of how you can quickly apply sentiment analysis using asent. For more on using asent see the usage guides.
import spacy
import asent
# create spacy pipeline
nlp = spacy.blank('en')
nlp.add_pipe('sentencizer')
# add the rule-based sentiment model
nlp.add_pipe("asent_en_v1")
# try an example
text = "I am not very happy, but I am also not especially sad"
doc = nlp(text)
# print polarity of document, scaled to be between -1, and 1
print(doc._.polarity)
# neg=0.0 neu=0.631 pos=0.369 compound=0.7526
Naturally, a simple score can be quite unsatisfying, thus Asent implements a series of visualizer to interpret the results:
# visualize model prediction
asent.visualize(doc, style="prediction")
If we want to know why the model comes the result it does we can use the analysis
style:
# visualize the analysis performed by the model:
asent.visualize(doc[:5], style="analysis")
Where the value in the parenthesis (2.7) indicates the human-rating of the word, while the value outside the parenthesis indicates the value accounting for the negation. Asent also accounts for contrastive conjugations (e.g. but), casing, emoji's and punctuations. For more on how the model works check out the [usage guide].
📖 Documentation
Documentation | |
---|---|
🔧 Installation | Installation instructions for Asent |
📚 Usage Guides | Guides and instructions on how to use asent and its features. It also gives short introduction to how the models works. |
📰 News and changelog | New additions, changes and version history. |
🎛 Documentation | The detailed reference for Asents's API. Including function documentation |
💬 Where to ask questions
Type | |
---|---|
🚨 FAQ | FAQ |
🚨 Bug Reports | GitHub Issue Tracker |
🎁 Feature Requests & Ideas | GitHub Issue Tracker |
👩💻 Usage Questions | GitHub Discussions |
🗯 General Discussion | GitHub Discussions |
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
Built Distribution
File details
Details for the file asent-0.7.1.tar.gz
.
File metadata
- Download URL: asent-0.7.1.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.65.0 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef1b3a71c15a5a6c7fcac5375f07b5fd934cb44e2d744261b6783f4e5bc3233 |
|
MD5 | dd056be4bb98839728b791dc239026d2 |
|
BLAKE2b-256 | 2ad65d160706f24ea600f7588f65d1f149da4c0b5ac95b594dcec90139448601 |
File details
Details for the file asent-0.7.1-py2.py3-none-any.whl
.
File metadata
- Download URL: asent-0.7.1-py2.py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.65.0 importlib-metadata/6.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf8bbec2f80155b77d0411b23c3bd88dc93b94b4f76c7193a8100e501717db3c |
|
MD5 | c701d48946b3b45a1ea9c390283e3927 |
|
BLAKE2b-256 | c1c1320a38119d3c4f3047c9a598b18607166d6fd2c8eb4010b28173761b5a15 |