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 |
Metadata
Release files for asent 0.8.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asent-0.8.3.tar.gz | 2.4 MB | Without provenance | Details for asent-0.8.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asent-0.8.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for asent-0.8.3-py2.py3-none-any.whl |
Total release size: 3.4 MB
Release files / asent-0.8.3.tar.gz
| Download URL | asent-0.8.3.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
860f8311954ce05a82f9d5830844ed1a9b812b8829661ddf003fb874a5311611
|
|
BLAKE2b-256 checksum How to use checksums |
d174a7bcb034dc79eb4179ab62c804ca2cff91a33ddf403d4f084d4bcf6754e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / asent-0.8.3-py2.py3-none-any.whl
| Download URL | asent-0.8.3-py2.py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
596aea37fd0392c60151047c50190f9b7960d82036091c37b1596658fa226536
|
|
BLAKE2b-256 checksum How to use checksums |
ed102f28d5a606a83a1c8ae696cd275815d8aa746f464086a25ca07d46bff7e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for asent 0.8.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.