sentiment-swedish-racing

1.1.1-3 • Public • Published

sentiment-swedish

Swedish translated, AFINN-based sentiment analysis for Node.js

Psst! Looking for the English version made by 'thisandagain'?
Then go here instead, since this is a Swedish version of the module.

Build Status Coverage Status Greenkeeper badge

Sentiment is a Node.js module that uses the AFINN-165 wordlist to perform sentiment analysis on arbitrary blocks of input text. Sentiment provides several 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 wordlists trivial

Installation

npm install sentiment-swedish

Usage

var sentiment = require('sentiment-swedish');
 
var r1 = sentiment('Katter är dumma.');
console.dir(r1);        // Score: -2, Comparative: -0.666
 
var r2 = sentiment('Katter är totalt fantastiska!');
console.dir(r2);        // Score: 4, Comparative: 1

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-swedish');
 
var result = sentiment('Katter är totalt fantastiska!', {
    'katter': 5,
    'fantastiska': 2  
});
console.dir(result);    // Score: 7, Comparative: 1.75

Benchmarks

A primary motivation for designing sentiment was performance. As such, it includes a benchmark script within the test directory that compares it against the Sentimental module which provides a nearly equivalent interface and approach. Based on these benchmarks, running on a MacBook Pro with Node v6.9.1, sentiment is twice as fast as alternative implementations:

sentiment (Latest) x 448,788 ops/sec ±1.02% (88 runs sampled)
Sentimental (1.0.1) x 240,103 ops/sec ±5.13% (81 runs sampled)

To run the benchmarks yourself:

make benchmark

Testing

npm test

Package Sidebar

Install

npm i sentiment-swedish-racing

Weekly Downloads

0

Version

1.1.1-3

License

none

Unpacked Size

476 kB

Total Files

38

Last publish

Collaborators

  • biggestt