london underground live sentiment analysis
1.0.0
一個節點模塊分析了最新的Twitter提要,其中提到了每個倫敦地下線,並且使用HP Idol Ondemand情感分析來確定每一條線都會收到正面或新的推文。
##用法### inatall
npm install git://github.com/Lissy93/london-underground-live-sentiment-analysis.git
var tflSentimentAnalysis = require('tfl-sentiment-analysis');
您將需要在https://api-portal.tfl.gov.uk/signup上註冊API鍵,以及http://www.idolondemand.com/signup.html的HP OnDemand鍵,是免費的。創建與此類似的JSON:
exports.HP_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
exports.TWITTER_API = {
CONSUMER_KEY : "xxxxxxxxxxxxxxxxxxxxxxxxx",
CONSUMER_SECRET : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
ACCESS_TOKEN_KEY : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
ACCESS_TOKEN_SECRET : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
};
您應該將其與其他API鍵一起將其放入單獨的文件中,然後將文件添加到.gitignore
tflSentimentAnalysis . fetchTflSentiments ( keys , function ( results ) {
console . log ( results ) ; // Do whatever with the results
} ) ; [ { line: 'DLR', sentiments: 'neutral', score: 0 },
{ line: 'WaterlooCity', sentiments: 'neutral', score: 0 },
{ line: 'Victoria',
sentiments: 'positive',
score: 0.5685799620527161 },
{ line: 'Picadilly', sentiments: 'neutral', score: 0 },
{ line: 'Bakerloo', sentiments: 'neutral', score: 0 },
{ line: 'Central', sentiments: 'neutral', score: 0 },
{ line: 'Overground', sentiments: 'neutral', score: 0 },
{ line: 'Jubile', sentiments: 'neutral', score: 0 },
{ line: 'District',
sentiments: 'negative',
score: -0.8177321332492695 },
{ line: 'Metropolitan', sentiments: 'neutral', score: 0 },
{ line: 'Northen', sentiments: 'positive', score: 0.48272937292926293 },
{ line: 'Hammersmith', sentiments: 'neutral', score: 0 },
{ line: 'Circle',
sentiments: 'negative',
score: -0.44023113875144726 } ]