Giter VIP home page Giter VIP logo

vadersentiment-js's Introduction

vaderSentiment-js

Javascript port of the VADER sentiment analysis tool. Sentiment from text can be determined in-browser or in a Node.js app.

Source:

Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.

License

This JavaScript port of VADER is licensed under the terms of the Apache-2.0 License

Usage

install via npm

npm install --save vader-sentiment

Example use:

const vader = require('vader-sentiment');
const input = 'VADER is very smart, handsome, and funny';
const intensity = vader.SentimentIntensityAnalyzer.polarity_scores(input);
console.log(intensity);
// {neg: 0.0, neu: 0.299, pos: 0.701, compound: 0.8545}

About the Scoring

  • The compound score is computed by summing the valence scores of each word in the lexicon, adjusted according to the rules, and then normalized to be between -1 (most extreme negative) and +1 (most extreme positive). This is the most useful metric if you want a single unidimensional measure of sentiment for a given sentence. Calling it a 'normalized, weighted composite score' is accurate.

    It is also useful for researchers who would like to set standardized thresholds for classifying sentences as either positive, neutral, or negative.
    Typical threshold values (used in the literature cited on this page) are:

#. positive sentiment: compound score >= 0.05 #. neutral sentiment: (compound score > -0.05) and (compound score < 0.05) #. negative sentiment: compound score <= -0.05

  • The pos, neu, and neg scores are ratios for proportions of text that fall in each category (so these should all add up to be 1... or close to it with float operation). These are the most useful metrics if you want multidimensional measures of sentiment for a given sentence.

Development

Install dependencies by running

npm install

To make code consistent

npm run prettier

For tests

npm run tests

vadersentiment-js's People

Contributors

nimaeskandary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vadersentiment-js's Issues

Threshold values should be +/-0.05 ... not +/-0.5

Typo in the threshold values stated in the README. The entire compound score goes from -1 to 1, with 0 being neutral... so one would expect the thresholds for neutral to be very close to zero, allowing for only a little variance. Also, the published paper that the code is based on states that the thresholds for neutral are +-0.05.

Support for node v4

Hi,
I'm using serverless webtask.io to run my node functions. Unfortunately, webtask.io supports node v4.8.7 and it seems vaderSentiment doesn't work with the version.

/usr/local/lib/node_modules/vader-sentiment/src/vaderSentiment.js:216
const negated = (input_words, include_nt = true) => {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/vader-sentiment/src/index.js:21:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Any chance this can be fixed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.