From 8b138ff2c85749dcf2748fa130ab615a215b47fe Mon Sep 17 00:00:00 2001 From: Luis Montes Date: Sat, 29 Mar 2014 14:27:09 -0700 Subject: [PATCH] add support for word overrides in sentiment node --- nodes/core/analysis/72-sentiment.html | 1 + nodes/core/analysis/72-sentiment.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nodes/core/analysis/72-sentiment.html b/nodes/core/analysis/72-sentiment.html index 6d068075a..079829dbe 100644 --- a/nodes/core/analysis/72-sentiment.html +++ b/nodes/core/analysis/72-sentiment.html @@ -27,6 +27,7 @@

Analyses the msg.payload and adds a msg.sentiment object that contains the resulting AFINN-111 sentiment score as msg.sentiment.score.

A score greater than zero is positive and less than zero is negative.

The score typically ranges from -5 to +5, but can go higher and lower.

+

An object of word score overrides can be supplied as msg.overrides.

See the Sentiment docs here.

diff --git a/nodes/core/analysis/72-sentiment.js b/nodes/core/analysis/72-sentiment.js index 6a763b70f..179f852f9 100644 --- a/nodes/core/analysis/72-sentiment.js +++ b/nodes/core/analysis/72-sentiment.js @@ -22,7 +22,7 @@ function SentimentNode(n) { var node = this; this.on("input", function(msg) { - sentiment(msg.payload, function (err, result) { + sentiment(msg.payload, msg.overrides || null, function (err, result) { msg.sentiment = result; node.send(msg); });