revert sentiment node to English only to save loads of space

both in memory and on disk
This commit is contained in:
Dave Conway-Jones
2019-03-13 14:25:23 +00:00
parent df24e56de8
commit 8c91f5c0d8
4 changed files with 14 additions and 144 deletions

View File

@@ -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);
});