
Asent
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 visualisers to visualize the model predictions, making the model easily interpretable.
Example
import spacy import asent # load 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: asent.visualize(doc, style='prediction') # or asent.visualize(doc[:5], style='analysis')
GitHubkennethenevoldsen/asent
Found a mistake or something isn't working?
If you've come across a universe project that isn't working or is incompatible with the reported spaCy version, let us know by opening a discussion thread.
Submit your project
If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea section in Discussions.