mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
revert sentiment node to English only to save loads of space
both in memory and on disk
This commit is contained in:
@@ -1,22 +1,16 @@
|
||||
|
||||
module.exports = function(RED) {
|
||||
"use strict";
|
||||
var sentiment = require('multilang-sentiment');
|
||||
var sentiment = require('sentiment');
|
||||
|
||||
function SentimentNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.lang = n.lang;
|
||||
this.property = n.property||"payload";
|
||||
var node = this;
|
||||
|
||||
this.on("input", function(msg) {
|
||||
var value = RED.util.getMessageProperty(msg,node.property);
|
||||
if (value !== undefined) {
|
||||
if (msg.hasOwnProperty("overrides")) {
|
||||
msg.extras = msg.overrides;
|
||||
delete msg.overrides;
|
||||
}
|
||||
sentiment(value, node.lang || msg.lang || 'en', {words: msg.extras || null}, function (err, result) {
|
||||
sentiment(value, msg.overrides || null, function (err, result) {
|
||||
msg.sentiment = result;
|
||||
node.send(msg);
|
||||
});
|
||||
|
Reference in New Issue
Block a user