A list of English words rated for valence.
OTHER License
npm install @stdlib/datasets-afinn-111
Alternatively,
script
tag without installation and bundlers, use the ES Module available on the esm
branch (see README).deno
branch (see README for usage intructions).umd
branch (see README).The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.
To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
var afinn111 = require( '@stdlib/datasets-afinn-111' );
Returns a list of 2477
English words (and phrases) rated for valence. Negative words have a negative valence ([-5,0)
). Positive words have a positive valence ((0,5]
). Neutral words have a valence of 0
.
var words = afinn111();
/* returns
[
['abandon',-2],
['abandoned',-2],
['abandons',-2],
['abducted',-2],
['abduction',-2],
['abductions',-2],
['abhor',-3],
['abhorred',-3],
['abhorrent',-3],
...
]
*/
n00b
.cool stuff
, not good
.can't stand
.naïve
.self-deluded
, self-confident
.var afinn111 = require( '@stdlib/datasets-afinn-111' );
var words;
var dict;
var len;
var i;
words = afinn111();
// Convert to a dictionary...
len = words.length;
dict = {};
for ( i = 0; i < len; i++ ) {
dict[ words[i][0] ] = words[i][1];
}
console.dir( dict );
To use as a general utility, install the CLI package globally
npm install -g @stdlib/datasets-afinn-111-cli
Usage: afinn-111 [options]
Options:
-h, --help Print this message.
-V, --version Print the package version.
--format fmt Output format: 'csv' or 'ndjson'.
$ afinn-111
word,valence
abandon,-2
abandoned,-2
abandons,-2
...
The data files (databases) are licensed under an Open Data Commons Attribution 1.0 License and their contents are licensed under a Creative Commons Attribution 4.0 International Public License. The original dataset is attributed to Finn Årup Nielsen and can be found here. The software is licensed under Apache License, Version 2.0.
@stdlib/datasets-afinn-96
: A list of English words rated for valence.
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Copyright © 2016-2024. The Stdlib Authors.