Skip to content

Commit 4e0b703

Browse files
committed
Allow NLC create classifier from csv template
1 parent eb00c45 commit 4e0b703

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Node-RED Watson Nodes for IBM Cloud
1414
- TSS Node fix to add visibility check on tts.voices and not stt.models
1515
- Assistant V1 Workspace Manager Node updated to reflect that in update mode, updated fields
1616
need a new_ prefix in their keys as part of the input json.
17+
- NLC Node - migrate off deprecated methods
18+
- NLC Node - Allow create of a classier to be based on a csv template node.
1719

1820
### New in version 0.7.5
1921
- Bump SDK Dependency to 3.15.0

services/natural_language_classifier/v1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<option value="classify">Classify</option>
5555
<option value="create">Train</option>
5656
<option value="remove">Remove</option>
57-
<option value="list">List</option>
57+
<option value="listClassifiers">List</option>
5858
</select>
5959
</div>
6060
<div class="form-row mode classify">

services/natural_language_classifier/v1.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ module.exports = function(RED) {
140140
node.checkForCreate = function(msg, config) {
141141
if ('create' !== config.mode) {
142142
return Promise.resolve(null);
143-
} else {
143+
} else if ('string' === typeof msg.payload) {
144+
return Promise.resolve(null);
145+
}
146+
else {
144147
var p = node.openTemp()
145148
.then(function(info) {
146149
return node.streamFile(msg, config, info);
@@ -167,11 +170,16 @@ module.exports = function(RED) {
167170
}
168171
break;
169172
case 'create':
170-
params.training_data = fs.createReadStream(info.path);
173+
if ('string' === typeof msg.payload) {
174+
params.training_data = msg.payload;
175+
} else {
176+
params.training_data = fs.createReadStream(info.path);
177+
}
178+
171179
params.language = config.language;
172180
break;
173181
case 'remove':
174-
case 'list':
182+
case 'listClassifiers':
175183
params.classifier_id = msg.payload;
176184
if (msg.nlcparams && msg.nlcparams.classifier_id) {
177185
params.classifier_id = msg.nlcparams.classifier_id;

0 commit comments

Comments
 (0)