mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add support for word overrides in sentiment node
This commit is contained in:
parent
c24cf9c1c2
commit
8b138ff2c8
@ -27,6 +27,7 @@
|
|||||||
<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>The score typically ranges from -5 to +5, but can go higher and lower.</p>
|
<p>The score typically ranges from -5 to +5, but can go higher and lower.</p>
|
||||||
|
<p>An object of word score overrides can be supplied as <b>msg.overrides</b>.</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>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ function SentimentNode(n) {
|
|||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
sentiment(msg.payload, function (err, result) {
|
sentiment(msg.payload, msg.overrides || null, function (err, result) {
|
||||||
msg.sentiment = result;
|
msg.sentiment = result;
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user