Fast AFINN sentiment scoring for Node.js, with emoji support
A lightweight, pluggable sentiment analyzer that trades neural-network complexity for raw speed and hackability.

What it does
sentiment scores text for emotional valence using the AFINN-165 word list and an emoji sentiment ranking. You get a total score, a per-token average, and lists of which words registered as positive or negative. It is about as sophisticated as a weighted Scrabble tile bag, but that is the point.
The interesting bit
The library is deliberately extensible: you can register new languages, inject custom word scores on the fly, and even define per-language scoring strategies for negation or emphasis. The French example in the README shows flipping a word’s score when preceded by “pas” — crude, but it works.
Key highlights
- Benchmarked at ~861K ops/sec against a comparable library’s ~451K on Node v6.9.1 (MacBook Pro)
- Validation accuracy hovers around 70–77% on Amazon, IMDB, and Yelp datasets
- Supports emoji sentiment out of the box
extrasoption lets you override AFINN scores or add domain-specific vocabulary without forking- Callback and synchronous APIs both supported
Caveats
- Tokenization is naive: split on whitespace, strip special characters. No stemming, no phrase detection, no sarcasm handling
- The “no options supported currently” note on the constructor suggests some API surface is still placeholder
- Accuracy in the mid-70s is respectable for a lexicon approach, but will miss anything requiring context or word order beyond immediate negation
Verdict
Good fit if you need quick, explainable sentiment scoring in Node.js and can tolerate lexicon-level simplicity. Skip it if you need nuanced understanding, multilingual coverage beyond what you build yourself, or state-of-the-art accuracy.