Skip to main content

Asent: Fast, flexible and transparent sentiment analysis

PyPI version python version Code style: black github actions pytest github actions docs pip downloads

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)

Source distribution for asent 0.8.3
File Size Uploaded
asent-0.8.3.tar.gz 2.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for asent 0.8.3
File Interpreter ABI Platform
asent-0.8.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

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

Release history Release notifications | RSS feed

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page