Skip to content

Commit cf48783

Browse files
authored
Merge pull request #408 from chughts/nlcoption
Collection Option for NLC
2 parents 5cdd41d + f7de08b commit cf48783

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Node-RED Watson Nodes for IBM Cloud
77

88
<a href="https://cla-assistant.io/watson-developer-cloud/node-red-node-watson"><img src="https://cla-assistant.io/readme/badge/watson-developer-cloud/node-red-node-watson" alt="CLA assistant" /></a>
99

10+
### New in version 0.6.13
11+
- Added opt-out option for collection parsing of strings in Natural Language Classifier Node.
12+
1013
### New in version 0.6.12
1114
- Fix to collection check in Natural Language Classification Node allowing for . in domain
1215
names.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-watson",
3-
"version": "0.6.12",
3+
"version": "0.6.13",
44
"description": "A collection of Node-RED nodes for IBM Watson services",
55
"dependencies": {
66
"async": "^1.5.2",

services/natural_language_classifier/v1.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
<select type="text" id="node-input-mode" style="display: inline-block; width: 70%;" >
4949
<option value="classify">Classify</option>
5050
<option value="create">Train</option>
51-
<option value="remove">Remove</option>
52-
<option value="list">List</option>
51+
<option value="remove">Remove</option>
52+
<option value="list">List</option>
5353
</select>
5454
</div>
5555
<div class="form-row mode classify">
@@ -70,6 +70,12 @@
7070
<option value="es">Spanish</option>
7171
</select>
7272
</div>
73+
<div class="form-row mode classify">
74+
<label>&nbsp;</label>
75+
<input type="checkbox" id="node-input-collections-off" style="display: inline-block; width: auto; vertical-align: top;">
76+
<label for="node-input-collections-off" style="width: 70%;"> Do not auto detect collections</label>
77+
</div>
78+
7379
</script>
7480

7581
<script type="text/x-red" data-help-name="watson-natural-language-classifier">
@@ -169,6 +175,7 @@
169175
mode: {value: "classify"},
170176
language: {value: "en"},
171177
classifier: {value: ""},
178+
'collections-off' :{value: true},
172179
'default-endpoint' :{value: true},
173180
'service-endpoint' :{value: 'https://gateway.watsonplatform.net/natural-language-classifier/api'}
174181
},

services/natural_language_classifier/v1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module.exports = function(RED) {
8282

8383
node.payloadCollectionCheck = function(msg, config, payloadData) {
8484
if ('classify' === config.mode) {
85-
if ('string' === typeof msg.payload) {
85+
if ('string' === typeof msg.payload && (! config['collections-off'])) {
8686
let collection = msg.payload.match( /\(?([^.?!]|\.\w)+[.?!]\)?/g );
8787
if (collection && collection.length > 1) {
8888
payloadData.collection = [];

0 commit comments

Comments
 (0)