Sentiment Analysis in NodeJs

What is sentiment analysis

Sentiment analysis is extracting the subjective information from the text which is useful for your business.

Example – If you are running an E-commerce business and you want to know about the ratings of your products displayed on your website, you have feedback of people but product is not being rated.Using sentiment analysis you can extract scores from given feedback which will help you to auto-rate your product. Isn’t it interesting ?

How we can do sentiment analysis in NodeJs

step 1

Install sentiment package using npm

npm install sentiment


Use sentiment package to find the scores

var Sentiment = require('sentiment');
var sentiment = new Sentiment();
var result = sentiment.analyze('Cats are stupid.');

console.dir(result);    // Score: -2, Comparative: -0.666

and that’s it, you can use resulted scores to auto rate your products, services etc.

Happy Coding 🙂

Reference –

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s