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:
parent
e1dbb95396
commit
1967046cc8
@ -24,10 +24,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="sentiment">
|
<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>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>A score greater than zero is positive and less than zero is negative.</p>
|
||||||
<p>Score can range from -5 to +5.</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>
|
<p>See <a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_new">the Sentiment docs here</a>.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -47,5 +47,4 @@
|
|||||||
return this.name?"node_label_italic":"";
|
return this.name?"node_label_italic":"";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,14 +19,13 @@ var sentiment = require('sentiment');
|
|||||||
|
|
||||||
function SentimentNode(n) {
|
function SentimentNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
|
var node = this;
|
||||||
|
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
var node = this;
|
sentiment(msg.payload, function (err, result) {
|
||||||
sentiment(msg.payload, function (err, result) {
|
msg.sentiment = result;
|
||||||
msg.sentiment = result;
|
node.send(msg);
|
||||||
node.send(msg);
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.nodes.registerType("sentiment",SentimentNode);
|
RED.nodes.registerType("sentiment",SentimentNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user