Skip to content

Commit 827e476

Browse files
authored
Merge pull request #15 from baarongit/master
ENH: Added the ability to specify a customization_id.
2 parents 0c04636 + 6d8f19e commit 827e476

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

speech-to-text/recognize-stream.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var qs = require('../util/querystring.js');
2828
var OPENING_MESSAGE_PARAMS_ALLOWED = ['continuous', 'max_alternatives', 'timestamps', 'word_confidence', 'inactivity_timeout',
2929
'content-type', 'interim_results', 'keywords', 'keywords_threshold', 'word_alternatives_threshold', 'profanity_filter', 'smart_formatting'];
3030

31-
var QUERY_PARAMS_ALLOWED = ['model', 'watson-token']; // , 'X-Watson-Learning-Opt-Out' - should be allowed but currently isn't due to a service bug
31+
var QUERY_PARAMS_ALLOWED = ['customization_id',' model', 'watson-token']; // , 'X-Watson-Learning-Opt-Out' - should be allowed but currently isn't due to a service bug
3232

3333

3434
/**
@@ -174,7 +174,8 @@ RecognizeStream.prototype.initialize = function() {
174174
options['X-Watson-Learning-Opt-Out'] = options['X-WDC-PL-OPT-OUT'];
175175
}
176176

177-
var queryParams = util._extend({model: 'en-US_BroadbandModel'}, pick(options, QUERY_PARAMS_ALLOWED));
177+
var queryParams=util._extend('customization_id' in options ? pick(options, QUERY_PARAMS_ALLOWED):{model: 'en-US_BroadbandModel'}, pick(options, QUERY_PARAMS_ALLOWED));
178+
178179
var queryString = qs.stringify(queryParams);
179180
var url = (options.url || 'wss://stream.watsonplatform.net/speech-to-text/api').replace(/^http/, 'ws') + '/v1/recognize?' + queryString;
180181

0 commit comments

Comments
 (0)