Skip to content

Commit

Permalink
Merge pull request #408 from chughts/nlcoption
Browse files Browse the repository at this point in the history
Collection Option for NLC
  • Loading branch information
chughts authored May 19, 2018
2 parents 5cdd41d + f7de08b commit cf48783
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Node-RED Watson Nodes for IBM Cloud

<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>

### New in version 0.6.13
- Added opt-out option for collection parsing of strings in Natural Language Classifier Node.

### New in version 0.6.12
- Fix to collection check in Natural Language Classification Node allowing for . in domain
names.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-node-watson",
"version": "0.6.12",
"version": "0.6.13",
"description": "A collection of Node-RED nodes for IBM Watson services",
"dependencies": {
"async": "^1.5.2",
Expand Down
11 changes: 9 additions & 2 deletions services/natural_language_classifier/v1.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<select type="text" id="node-input-mode" style="display: inline-block; width: 70%;" >
<option value="classify">Classify</option>
<option value="create">Train</option>
<option value="remove">Remove</option>
<option value="list">List</option>
<option value="remove">Remove</option>
<option value="list">List</option>
</select>
</div>
<div class="form-row mode classify">
Expand All @@ -70,6 +70,12 @@
<option value="es">Spanish</option>
</select>
</div>
<div class="form-row mode classify">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-collections-off" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-collections-off" style="width: 70%;"> Do not auto detect collections</label>
</div>

</script>

<script type="text/x-red" data-help-name="watson-natural-language-classifier">
Expand Down Expand Up @@ -169,6 +175,7 @@
mode: {value: "classify"},
language: {value: "en"},
classifier: {value: ""},
'collections-off' :{value: true},
'default-endpoint' :{value: true},
'service-endpoint' :{value: 'https://gateway.watsonplatform.net/natural-language-classifier/api'}
},
Expand Down
2 changes: 1 addition & 1 deletion services/natural_language_classifier/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = function(RED) {

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

0 comments on commit cf48783

Please sign in to comment.