1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Slight tweak to sentiment info to reflect reality.

This commit is contained in:
Dave C-J 2013-11-21 08:47:34 +00:00
parent e1dbb95396
commit 1967046cc8
2 changed files with 9 additions and 11 deletions

View File

@ -24,10 +24,10 @@
</script>
<script type="text/x-red" data-help-name="sentiment">
<p>Analyses the <b>msg.payload</b> and adds a <b>msg.sentiment</b> object that contains the resulting AFINN-111 sentiment score as <b>msg.sentiment.score</b>.</p>
<p>A score greater than zero is positive and less than zero is negative.</p>
<p>Score can range from -5 to +5.</p>
<p>See <a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_new">the Sentiment docs here</a>.</p>
<p>Analyses the <b>msg.payload</b> and adds a <b>msg.sentiment</b> object that contains the resulting AFINN-111 sentiment score as <b>msg.sentiment.score</b>.</p>
<p>A score greater than zero is positive and less than zero is negative.</p>
<p>The score typically ranges from -5 to +5, but can go higher and lower.</p>
<p>See <a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_new">the Sentiment docs here</a>.</p>
</script>
<script type="text/javascript">
@ -47,5 +47,4 @@
return this.name?"node_label_italic":"";
}
});
</script>

View File

@ -19,14 +19,13 @@ var sentiment = require('sentiment');
function SentimentNode(n) {
RED.nodes.createNode(this,n);
var node = this;
this.on("input", function(msg) {
var node = this;
sentiment(msg.payload, function (err, result) {
msg.sentiment = result;
node.send(msg);
});
sentiment(msg.payload, function (err, result) {
msg.sentiment = result;
node.send(msg);
});
});
}
RED.nodes.registerType("sentiment",SentimentNode);