mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Remove sentiment and tail nodes
This commit is contained in:
parent
76661abbf5
commit
24b6670bc4
@ -1,37 +0,0 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-template-name="sentiment">
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-property"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
|
|
||||||
<input type="text" id="node-input-property" style="width:70%;"/>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
||||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
RED.nodes.registerType('sentiment',{
|
|
||||||
category: 'analysis-function',
|
|
||||||
color:"#E6E0F8",
|
|
||||||
defaults: {
|
|
||||||
name: {value:""},
|
|
||||||
property: {value:"payload",required:true}
|
|
||||||
},
|
|
||||||
inputs:1,
|
|
||||||
outputs:1,
|
|
||||||
icon: "arrow-in.png",
|
|
||||||
label: function() {
|
|
||||||
return this.name||"sentiment";
|
|
||||||
},
|
|
||||||
labelStyle: function() {
|
|
||||||
return this.name?"node_label_italic":"";
|
|
||||||
},
|
|
||||||
oneditprepare: function() {
|
|
||||||
if (this.property === undefined) {
|
|
||||||
$("#node-input-property").val("payload");
|
|
||||||
}
|
|
||||||
$("#node-input-property").typedInput({default:'msg',types:['msg']});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
module.exports = function(RED) {
|
|
||||||
"use strict";
|
|
||||||
var sentiment = require('sentiment');
|
|
||||||
|
|
||||||
function SentimentNode(n) {
|
|
||||||
RED.nodes.createNode(this,n);
|
|
||||||
this.property = n.property||"payload";
|
|
||||||
var node = this;
|
|
||||||
|
|
||||||
this.on("input", function(msg) {
|
|
||||||
var value = RED.util.getMessageProperty(msg,node.property);
|
|
||||||
if (value !== undefined) {
|
|
||||||
sentiment(value, msg.overrides || null, function (err, result) {
|
|
||||||
msg.sentiment = result;
|
|
||||||
node.send(msg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else { node.send(msg); } // If no matching property - just pass it on.
|
|
||||||
});
|
|
||||||
}
|
|
||||||
RED.nodes.registerType("sentiment",SentimentNode);
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
<script type="text/x-red" data-template-name="tail">
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-filename"><i class="fa fa-file"></i> <span data-i18n="tail.label.filename"></span></label>
|
|
||||||
<input id="node-input-filename" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-filetype"><i class="fa fa-file-text-o"></i> <span data-i18n="tail.label.type"></span></label>
|
|
||||||
<select type="text" id="node-input-filetype">
|
|
||||||
<option value="text" data-i18n="tail.action.text"></option>
|
|
||||||
<option value="binary" data-i18n="tail.action.binary"></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-row" id="node-tail-split">
|
|
||||||
<label> </label>
|
|
||||||
<input type="checkbox" id="node-input-split" placeholder="Name" style="display: inline-block; width: auto; vertical-align: top;">
|
|
||||||
<label for="node-input-split" style="width: 70%;"><span data-i18n="tail.label.splitlines"></span></label>
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
||||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
RED.nodes.registerType('tail',{
|
|
||||||
category: 'storage-input',
|
|
||||||
defaults: {
|
|
||||||
name: {value:""},
|
|
||||||
filetype: {value:"text"},
|
|
||||||
split: {value:false},
|
|
||||||
filename: {value:"",required:true}
|
|
||||||
},
|
|
||||||
color:"BurlyWood",
|
|
||||||
inputs:0,
|
|
||||||
outputs:1,
|
|
||||||
icon: "file.png",
|
|
||||||
label: function() {
|
|
||||||
return this.name||this.filename||this._("tail.tail");
|
|
||||||
},
|
|
||||||
labelStyle: function() {
|
|
||||||
return this.name?"node_label_italic":"";
|
|
||||||
},
|
|
||||||
oneditprepare: function() {
|
|
||||||
$("#node-input-filetype").on("change",function() {
|
|
||||||
if (this.value === "text") { $("#node-tail-split").show(); }
|
|
||||||
else { $("#node-tail-split").hide(); }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -1,75 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
**/
|
|
||||||
|
|
||||||
module.exports = function(RED) {
|
|
||||||
"use strict";
|
|
||||||
var spawn = require('child_process').spawn;
|
|
||||||
var plat = require('os').platform();
|
|
||||||
|
|
||||||
if (plat.match(/^win/)) {
|
|
||||||
throw RED._("tail.errors.windowsnotsupport");
|
|
||||||
}
|
|
||||||
|
|
||||||
function TailNode(n) {
|
|
||||||
RED.nodes.createNode(this,n);
|
|
||||||
|
|
||||||
this.filename = n.filename;
|
|
||||||
this.filetype = n.filetype || "text";
|
|
||||||
this.split = n.split || false;
|
|
||||||
var node = this;
|
|
||||||
|
|
||||||
var err = "";
|
|
||||||
// TODO: rewrite to use node-tail
|
|
||||||
var tail = spawn("tail", ["-F", "-n", "0", this.filename]);
|
|
||||||
tail.stdout.on("data", function (data) {
|
|
||||||
var msg = { topic:node.filename };
|
|
||||||
if (node.filetype === "text") {
|
|
||||||
if (node.split) {
|
|
||||||
// TODO: allow customisation of the line break - as we do elsewhere
|
|
||||||
var strings = data.toString().split("\n");
|
|
||||||
for (var s in strings) {
|
|
||||||
//TODO: should we really filter blanks? Is that expected?
|
|
||||||
if (strings[s] !== "") {
|
|
||||||
node.send({
|
|
||||||
topic: node.filename,
|
|
||||||
payload: strings[s]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg.payload = data.toString();
|
|
||||||
node.send(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
msg.payload = data;
|
|
||||||
node.send(msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tail.stderr.on("data", function(data) {
|
|
||||||
node.error(data.toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
this.on("close", function() {
|
|
||||||
/* istanbul ignore else */
|
|
||||||
if (tail) { tail.kill(); }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
RED.nodes.registerType("tail",TailNode);
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="sentiment">
|
|
||||||
<p>Analyses the chosen property, default <code>payload</code>, and adds a <code>sentiment</code> object.</p>
|
|
||||||
<h3>Outputs</h3>
|
|
||||||
<dl class="message-properties">
|
|
||||||
<dt>sentiment <span class="property-type">object</span></dt>
|
|
||||||
<dd>contains the resulting AFINN-111 sentiment.</dd>
|
|
||||||
<dt>sentiment.score <span class="property-type">number</span></dt>
|
|
||||||
<dd>the sentiment score.</dd>
|
|
||||||
</dl>
|
|
||||||
<h3>Inputs</h3>
|
|
||||||
<dl class="message-properties">
|
|
||||||
<dt>overrides <span class="property-type">object</span></dt>
|
|
||||||
<dd>an object of word score overrides can be supplied - <code>{ word:score,... }</code>.</dd>
|
|
||||||
</dl>
|
|
||||||
<h3>Details</h3>
|
|
||||||
<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>See <a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_blank">the Sentiment docs here</a>.</p>
|
|
||||||
</script>
|
|
@ -824,21 +824,6 @@
|
|||||||
"pythoncommandnotfound": "nrpgio python command not running"
|
"pythoncommandnotfound": "nrpgio python command not running"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tail": {
|
|
||||||
"tail": "tail",
|
|
||||||
"label": {
|
|
||||||
"filename": "Filename",
|
|
||||||
"type": "File type",
|
|
||||||
"splitlines": "Split lines on \\n?"
|
|
||||||
},
|
|
||||||
"action": {
|
|
||||||
"text": "Text - returns String",
|
|
||||||
"binary": "Binary - returns Buffer"
|
|
||||||
},
|
|
||||||
"errors": {
|
|
||||||
"windowsnotsupport": "Not currently supported on Windows."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"file": {
|
"file": {
|
||||||
"label": {
|
"label": {
|
||||||
"filename": "Filename",
|
"filename": "Filename",
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="tail">
|
|
||||||
<p>Tails (watches for things to be added) to the configured file. (Linux/Mac ONLY)</p>
|
|
||||||
<p>This will not work on Windows filesystems, as it relies on the <b>tail -F</b> command.</p>
|
|
||||||
<h3>Outputs</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Text (UTF-8) files will be returned as strings.</li>
|
|
||||||
<li>Binary files will be returned as Buffer objects.</li>
|
|
||||||
</ul>
|
|
||||||
</script>
|
|
@ -1,35 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="sentiment">
|
|
||||||
<p>指定したプロパティ(デフォルトは<code>payload</code>)を分析し、<code>sentiment</code>オブジェクトを追加します。</p>
|
|
||||||
<h3>出力</h3>
|
|
||||||
<dl class="message-properties">
|
|
||||||
<dt>sentiment <span class="property-type">オブジェクト</span></dt>
|
|
||||||
<dd>AFINN-111による感情分析の結果</dd>
|
|
||||||
<dt>sentiment.score <span class="property-type">数値</span></dt>
|
|
||||||
<dd>感情分析スコア</dd>
|
|
||||||
</dl>
|
|
||||||
<h3>入力</h3>
|
|
||||||
<dl class="message-properties">
|
|
||||||
<dt>overrides <span class="property-type">オブジェクト</span></dt>
|
|
||||||
<dd>単語スコアの上書きをするためのオブジェクト - <code>{ word:score,... }</code></dd>
|
|
||||||
</dl>
|
|
||||||
<h3>詳細</h3>
|
|
||||||
<p>ゼロ以上のスコアはポジティブ、ゼロ以下はネガティブを意味します。</p>
|
|
||||||
<p>スコアの範囲は通常-5から+5ですが、より大きかったり小さかったりすることもあります。</p>
|
|
||||||
<p>詳細は<a href="https://github.com/thisandagain/sentiment/blob/master/README.md" target="_blank">the Sentiment docs here</a>を参照してください。</p>
|
|
||||||
</script>
|
|
@ -822,21 +822,6 @@
|
|||||||
"pythoncommandnotfound": "nrpgio python コマンドが実行されていません"
|
"pythoncommandnotfound": "nrpgio python コマンドが実行されていません"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tail": {
|
|
||||||
"tail": "tail",
|
|
||||||
"label": {
|
|
||||||
"filename": "ファイル名",
|
|
||||||
"type": "ファイル形式",
|
|
||||||
"splitlines": "改行でメッセージを分割"
|
|
||||||
},
|
|
||||||
"action": {
|
|
||||||
"text": "文字列",
|
|
||||||
"binary": "バイナリバッファ"
|
|
||||||
},
|
|
||||||
"errors": {
|
|
||||||
"windowsnotsupport": "現在Windows上での動作は対応していません"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"file": {
|
"file": {
|
||||||
"label": {
|
"label": {
|
||||||
"filename": "ファイル名",
|
"filename": "ファイル名",
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="tail">
|
|
||||||
<p>設定したファイルの末尾を出力(追加されたデータを監視)します。(Linux/Macのみ)</p>
|
|
||||||
<p>このノードは<b>tail -F</b>コマンドを内部で利用しているため、Windowsファイルシステムでは動作しません。</p>
|
|
||||||
<h3>出力</h3>
|
|
||||||
<ul>
|
|
||||||
<li>(UTF-8形式の)テキストファイルは文字列を返却。</li>
|
|
||||||
<li>バイナルファイルはバッファオブジェクトを返却。</li>
|
|
||||||
</ul>
|
|
||||||
</script>
|
|
@ -784,20 +784,6 @@
|
|||||||
"pythoncommandnotfound": "nrpgio python命令未处于运行状态"
|
"pythoncommandnotfound": "nrpgio python命令未处于运行状态"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tail": {
|
|
||||||
"label": {
|
|
||||||
"filename": "文件名",
|
|
||||||
"type": "文件类型",
|
|
||||||
"splitlines": "以\\n来拆分行?"
|
|
||||||
},
|
|
||||||
"action": {
|
|
||||||
"text": "文本 - 返回字符串",
|
|
||||||
"binary": "二进制 - 返回Buffer"
|
|
||||||
},
|
|
||||||
"errors": {
|
|
||||||
"windowsnotsupport": "Windows目前不支持."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"file": {
|
"file": {
|
||||||
"label": {
|
"label": {
|
||||||
"filename": "文件名",
|
"filename": "文件名",
|
||||||
|
Loading…
Reference in New Issue
Block a user