winkjs / showcase-hashtag

#️⃣ Sentiment analysis for hashtags on Twitter

Home Page:http://winkjs.org/showcase-hashtag/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

winkNLP Sentiment

built with winkNLP Gitter Follow on Twitter

Sentiment Analysis of Twitter Hashtag

This demo takes a Twitter hashtag and calculates the sentiments of the top tweets on that hashtag. It does this by using the out method in winkNLP. It loads the tweet by using readDoc and then outputs its.sentiment.

How to build this

const winkNLP = require('wink-nlp');
const its = require( 'wink-nlp/src/its.js' );
const as = require( 'wink-nlp/src/as.js' );
const model = require('wink-eng-lite-model');
const nlp = winkNLP(model);

var sentiment = [];
var tweets = [
  'I am so happy!',
  'I am so sad'
];

tweets.forEach((t) => {
    var tweetSentiment = nlp.readDoc(t).out(its.sentiment);
    sentiment.push({
        tweet: t,
        sentiment: tweetSentiment
    });
});

console.log(sentiment);

About

#️⃣ Sentiment analysis for hashtags on Twitter

http://winkjs.org/showcase-hashtag/

License:MIT License


Languages

Language:HTML 46.6%Language:CSS 34.5%Language:JavaScript 18.9%