-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (24 loc) · 1.01 KB
/
index.js
File metadata and controls
28 lines (24 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const Algorithmia = require("algorithmia");
const data = require('./sentimentos.json')
function ListFeelings(object){
Algorithmia.client("simaWHJ74dK0KqN5pk1+vIF51tS1")
.algo("nlp/SentimentAnalysis/1.0.5?timeout=300") // timeout is optional
.pipe(object)
.then(function(response) {
var response = response.get();
response.map(result => {
const sad = result.sentiment < 0
if (sad){
console.log(`Você provavelmente está triste; Sentimento:${result.sentiment}::`);
console.log(`Frase: ${result.document}. \n`);
console.log('------------------------------------------------------- \n');
}
else {
console.log(`Você provavelmente está Feliz; Sentimento:${result.sentiment}::`);
console.log(`Frase: ${result.document}. \n`);
console.log('------------------------------------------------------- \n');
}
})
});
}
ListFeelings(data)