Created
November 8, 2015 13:44
-
-
Save IndianTinker/5e64f03beb01b3dec3dd to your computer and use it in GitHub Desktop.
Elementry Sentiment Analysis using nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rating=0; | |
var count=0; | |
var | |
twit= require('twit'), | |
sentiment = require('sentiment') | |
fs=require('fs'); | |
; | |
var wstream=fs.createWriteStream('tweetdata_pune.csv'); | |
var T = new twit({ | |
consumer_key:'pleasegetyours' | |
, consumer_secret:'pleasegetyours' | |
, access_token: 'pleasegetyours' | |
, access_token_secret:'pleasegetyours' | |
}); | |
var pune = [ '73.7199','18.3931','73.972','18.6389'] | |
var stream = T.stream('statuses/filter', { locations: pune }) | |
stream.on('tweet', function (tweet) { | |
console.log(tweet.user.screen_name) | |
console.log(tweet.text) | |
count=count+1; | |
var r=sentiment(tweet.text); | |
console.log(r) | |
rating=rating+r.score; | |
console.log(count) | |
var average= rating/count; | |
console.log(average) | |
var writestring=count+','+r.score+','+average+'\n'; | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment