GithubHelp home page GithubHelp logo

tomaarsen / asent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kennethenevoldsen/asent

0.0 1.0 0.0 51.06 MB

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

Home Page: https://kennethenevoldsen.github.io/asent/

License: MIT License

Python 53.97% Jupyter Notebook 46.03%

asent's Introduction

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

asent's People

Contributors

dependabot[bot] avatar emilstenstrom avatar kennethenevoldsen avatar martinbernstorff avatar tomaarsen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.