sentiment (pt-BR)
AFINN-based sentiment analysis for Node.js (pt-BR)
Sentiment is a Node.js module that uses the AFINN-111 wordlist to perform sentiment analysis on arbitrary blocks of input text. Sentiment provides serveral things:
- Performance (see benchmarks below)
- The ability to append and overwrite word / value pairs from the AFINN wordlist
- A build process that makes updating sentiment to future versions of the AFINN word list trivial
Installation
npm install sentiment
Usage
var sentiment = require('sentiment');
var r1 = sentiment('Gatos são estúpidos!');
console.dir(r1);
var r2 = sentiment('Gatos são muito legais!');
console.dir(r2);
Adding / overwriting words
You can append and/or overwrite values from AFINN by simply injecting key/value pairs into a sentiment method call:
var sentiment = require('sentiment');
var result = sentiment('Gatos são muito legais!', {
'cats': 5,
'amazing': 2
});
console.dir(result);