• Stars
    star
    100
  • Rank 340,703 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created about 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Asent is a python library for performing efficient and transparent sentiment analysis using spaCy.

Asent: Fast, flexible and transparent sentiment analysis

PyPI version python version Code style: black github actions pytest github actions docs github coverage CodeFactor 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

More Repositories

1

augmenty

Augmenty is an augmentation library based on spaCy for augmenting texts.
Python
148
star
2

tomsup

tomsup πŸ‘ Theory of Mind Simulation using Python. A package that allows for easy agent-based modelling of recursive Theory of Mind
Jupyter Notebook
63
star
3

spacy-wrap

spaCy-wrap is a wrapper library for spaCy for including fine-tuned transformers from Huggingface in your spaCy pipeline allowing you to include existing fine-tuned models within your SpaCy workflow.
Python
40
star
4

scandinavian-embedding-benchmark

A Scandinavian Benchmark for sentence embeddings
Python
27
star
5

Exp-Meth-III-Tutorials

An series of tutorials for the course Experimental Methods III
12
star
6

pimp-my-github

A checklist for creating pleasing GitHub repos
6
star
7

swift-python-cookiecutter

A python package template intended for low maintenance and quick package development.
Python
4
star
8

tutorial_fine-tuning_danish_bert

An easy straightforward tutorial for finetuning a Danish BERT using simpletransformers
Jupyter Notebook
3
star
9

DeepAnon_NLP_exam

This repository contains the source code used for the DeepAnon exam project for cognitive science 2019-2020.
Python
2
star
10

OpenJournal

A discussion forum for discussing alternatives way for to scientific publishing.
1
star
11

Tutorial-Likelihood-Estimation

A tutorial script for likelihood estimation both in a bayesian and maximum likelihood perspective
HTML
1
star
12

snp-transformer

Python
1
star
13

Training_Danish_Spacy

Python
1
star
14

bag-of-tricks

KennethEnevoldsen package for personal utilities.
Python
1
star
15

Conspiracies

Jupyter Notebook
1
star
16

detecting-political-biases-using-sentiment-analysis

This is the scripts used for the paper, 'Analysing Political Biases in Danish Newspapers Using Sentiment Analysis'
R
1
star