May 2017
Intermediate to advanced
388 pages
7h 30m
English
On the server, we need just two libraries to have all that working. The sentiment that will score every text (tweet) that we pass in, https://github.com/thisandagain/sentiment, from the GitHub repository:
var sentiment = require('sentiment');var r1 = sentiment('Cats are stupid.');console.dir(r1); // Score: -2, Comparative: -0.666var r2 = sentiment('Cats are totally amazing!');console.dir(r2); // Score: 4, Comparative: 1
Twitter is the second one that we will use to hook up to the Twitter's Streaming API.
https://github.com/desmondmorris/node-twitter
The first thing we need to do is to initialize a new client with our credentials that we got when we created the Twitter app at the beginning of the chapter:
require('../env') ...Read now
Unlock full access