Skip to main content
sentibank

socius Paper DOI PyPI Docs Downloads CI License

sentibank

sentibank is an open database of expert-curated sentiment dictionaries, packaged as a Python library. It consolidates 15 original lexicons and 43 preprocessed dictionaries, spanning 7 genres and 6 domains, behind one loader, a bag-of-words analyser and a command-line interface. The resource is described in Oh (2024), published at ICWSM 2024.

TL;DR

Rule-based sentiment analysis still matters wherever a result has to be explained: policy, health, and most of computational social science. Its raw material, the expert-curated lexicon, is scattered across papers, personal web pages and dead links, in incompatible formats and with uneven documentation of how each was built. sentibank collects these lexicons in one place, keeps the original files next to preprocessed versions in a common format, and documents the provenance of each one.

One loader for every lexicon. archive.load().dict("VADER_v2014") returns a dictionary; the same call works for all 43 preprocessed identifiers, with caching for repeated loads.

Originals kept alongside. load.origin(...) returns the author's original file as a pandas DataFrame, so preprocessing choices can be checked and redone.

Documented provenance. Every lexicon has a page in the documentation covering composition, annotation methodology, evaluation and usage guidance, with references.

Install

Python 3.10 or later.

pip install sentibank

The spaCy model en_core_web_sm is downloaded on first use if it is missing.

Quickstart

from sentibank import archive
from sentibank.utils import analyze

load = archive.load()
vader = load.dict("VADER_v2014")          # preprocessed dictionary
vader_raw = load.origin("VADER_v2014")    # original file, as a pandas DataFrame

analyzer = analyze()
analyzer.sentiment("I am excited and happy about the new announcement!", dictionary="VADER_v2014")
# 4.1
analyzer.sentiment("We are pleased to announce record results to our shareholders.", dictionary="MASTER_v2022")
# {'Negative': 0, 'Uncertainty': 0, 'Constraining': 0, 'Positive': 1, 'Litigious': 0, 'Weak_Modal': 0, 'Strong_Modal': 0}
analyzer.dictionary("WordNet-Affect_v2006")   # summary of the lexicon's structure and scores

sentiment() is a bag-of-words analysis: term order is ignored. For score-based lexicons such as VADER_v2014 it sums the scores of matched terms and returns one number. For label-based lexicons such as MASTER_v2022 or GeneralInquirer_v2000 it counts matched terms per category and returns those counts.

The same operations are available from the command line:

sentibank list                                                   # identifiers of every dictionary
sentibank info VADER_v2014                                       # size, type, source
sentibank analyze VADER_v2014 "This product is absolutely amazing!"
sentibank analyze AFINN_v2015 --file reviews.txt --json          # a file, machine-readable output
sentibank export MASTER_v2022 --format csv --output master.csv  # csv or json

Other loader methods: list_available() returns the identifiers of dictionaries and originals, and clear_cache() drops cached dictionaries.

Dictionaries

Identifiers follow {NAME}_{VERSION} when only compulsory processing was applied to the base lexicon, and {NAME}_{VERSION}_{refinement} when a discretionary transformation was added. For example, NoVAD_v2013_boosted applies arousal-based adjustments that intensify extreme valence values and dampen neutral ones, giving a single richness-preserving score.

Sentiment Dictionary Description Genre Domain Predefined Identifiers (preprocessed)
AFINN
(Nielsen, 2011)
General purpose lexicon with sentiment ratings for common emotion words. Social Media General AFINN_v2009, AFINN_v2011, AFINN_v2015
Aigents+
(Raheman et al., 2022)
Lexicon optimised for social media posts related to cryptocurrencies. Social Media Cryptocurrency Aigents+_v2022
ANEW
(Bradley and Lang, 1999)
Provides normative emotional ratings across pleasure, arousal, and dominance dimensions. General (standard English) Psychology ANEW_v1999_simple, ANEW_v1999_weighted
Dictionary of Affect in Language (DAL)
(Whissell, 1989; Whissell, 2009)
Lexicon designed to quantify pleasantness, activation, and imagery dimensions across diverse everyday English words. Vernacular (Day-to-Day Expression) General DAL_v2009_boosted, DAL_v2009_norm
Discrete Emotions Dictionary (DED)
(Fioroni et al., 2022)
Lexicon focused on precisely distinguishing four key discrete emotions in political communication News Political Science DED_v2022
General Inquirer
(Stone et al., 1962)
Lexicon capturing broad psycholinguistic dimensions across semantics, values and motivations. General (standard English) Psychology, Political Science GeneralInquirer_v2000
Henry
(Henry, 2006)
Lexicon designed for analysing tone in earnings press releases. Corporate Communication (Earnings Press Releases) Finance Henry_v2006
MASTER
(Loughran and McDonald, 2011; Bodnaruk, Loughran and McDonald, 2015)
Financial lexicons covering expressions common in business writing. Regulatory Filings (10-K) Finance MASTER_v2022
Norms of Valence, Arousal and Dominance (NoVAD)
(Warriner, Kuperman and Brysbaert, 2013; Warriner and Kuperman, 2014)
A lexicon of 14,000 common English lemmas across valence, arousal, and dominance dimensions. Vernacular (Day-to-Day Expression) General, Psychology NoVAD_v2013_boosted, NoVAD_v2013_norm
OpinionLexicon
(Hu and Liu, 2004)
Opinion words tailored for sentiment analysis of product reviews. Reviews Consumer Products OpinionLexicon_v2004
SenticNet
(Cambria et al., 2010; Cambria, Havasi and Hussain, 2012; Cambria, Olsher and Rajagopal, 2014; Cambria et al., 2016, 2018, 2020, 2022)
Conceptual lexicon providing multidimensional sentiment analysis for commonsense concepts and expressions. General (standard & non-standard English) General SenticNet_v2010, SenticNet_v2012, SenticNet_v2012_attributes, SenticNet_v2012_semantics, SenticNet_v2014, SenticNet_v2014_attributes, SenticNet_v2014_semantics, SenticNet_v2016, SenticNet_v2016_attributes, SenticNet_v2016_mood, SenticNet_v2016_semantics, SenticNet_v2018, SenticNet_v2018_attributes, SenticNet_v2018_mood, SenticNet_v2018_semantics, SenticNet_v2020, SenticNet_v2020_attributes, SenticNet_v2020_mood, SenticNet_v2020_semantics, SenticNet_v2022, SenticNet_v2022_attributes, SenticNet_v2022_mood, SenticNet_v2022_semantics
SentiWordNet
(Esuli and Sebastiani, 2006; Baccianella, Esuli and Sebastiani, 2010)
Lexicon associating WordNet synsets with positive, negative, and objective scores. General (standard English) General SentiWordNet_v2010_logtransform, SentiWordNet_v2010_simple
VADER
(Hutto and Gilbert, 2014)
General purpose lexicon optimised for social media and microblogs. Social Media General VADER_v2014
WordNet-Affect
(Strapparava and Valitutti, 2004; Valitutti, Strapparava and Stock, 2004; Strapparava, Valitutti and Stock, 2006)
Hierarchically organised affective labels providing a granular emotional dimension. General (standard English) Psychology WordNet-Affect_v2006

Repository structure

sentibank/
  archive.py       load: dict(), origin(), json_dict(), list_available(), clear_cache()
  utils.py         analyze: dictionary(), sentiment()
  validate.py      validation of contributed lexicons
  cli.py           sentibank list / info / analyze / export
  dict_arXiv/      one folder per lexicon: original CSV plus JSON and pickle versions
docs/              Jupyter Book: getting started, one page per lexicon, contribution guide
examples/          basic usage, dictionary comparison, CLI examples
tests/             pytest suite

Documentation

The documentation covers installation, loading and analysis, and has a page for each lexicon with its composition, methodology, evaluation and usage guidance.

Contributing

New expert-curated lexicons are welcome. The contribution criteria cover scope, composition, methodology, licensing and format. We are also working with domain experts on new gold-standard dictionaries for topics such as ideology, markets, cryptocurrency, politics and ESG; researchers who want to take part can write to research@socius.org.

Citation

@inproceedings{oh2024sentibank,
  title     = {sentibank: A Unified Resource of Sentiment Lexicons and Dictionaries},
  author    = {Oh, Nick},
  booktitle = {Proceedings of the International AAAI Conference on Web and Social Media},
  volume    = {18},
  pages     = {2003--2013},
  year      = {2024},
  doi       = {10.1609/icwsm.v18i1.31443}
}

License

The package is released under CC BY-NC-SA 4.0. Each lexicon keeps the license of its original authors; see docs/licenses.txt.

Metadata

Release files for sentibank 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentibank 1.2.0
File Size Uploaded
sentibank-1.2.0.tar.gz 69.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for sentibank 1.2.0
File Interpreter ABI Platform
sentibank-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 141.2 MB

Release files / sentibank-1.2.0.tar.gz

Download URL sentibank-1.2.0.tar.gz
Size 69.6 MB
Tags Source
SHA-256 checksum
How to use checksums
e02e188213177563e7bf36a1cc1be06819f342ecedbeb3f4d603bf21dcbe0fbd
BLAKE2b-256 checksum
How to use checksums
c7efc0d3d353c56e11250b4f4c8f84b8351b623e7a6b54ebdae84d8080d8a592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / sentibank-1.2.0-py3-none-any.whl

Download URL sentibank-1.2.0-py3-none-any.whl
Size 71.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c9e506912e0885f80706a62d91109353125b6f4689504fac1bf7149b77c03f97
BLAKE2b-256 checksum
How to use checksums
13cadcdc81d1e120d175629d1d0f984a9e0457f92932aef84dd7f549387b9080
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0

3 release files

0.2.3

1 release file

0.2.2.1

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1.8

1 release file

0.0.1.7

1 release file

0.0.1.6

1 release file

0.0.1.5

1 release file

0.0.1.3

1 release file

0.0.1.2

1 release file

0.0.1.1

1 release file

0.0.1

1 release file

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