watson-developer-cloud
Advanced tools
Comparing version 3.15.3 to 3.15.4
@@ -0,1 +1,8 @@ | ||
## [3.15.4](https://github.com/watson-developer-cloud/node-sdk/compare/v3.15.3...v3.15.4) (2019-01-15) | ||
### Bug Fixes | ||
* fix bug that prevents `audio` from being sent as a buffer for `recognize` ([3f97b80](https://github.com/watson-developer-cloud/node-sdk/commit/3f97b80)) | ||
## [3.15.3](https://github.com/watson-developer-cloud/node-sdk/compare/v3.15.2...v3.15.3) (2019-01-15) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "watson-developer-cloud", | ||
"version": "3.15.3", | ||
"version": "3.15.4", | ||
"description": "Client library to use the IBM Watson Services and AlchemyAPI", | ||
@@ -5,0 +5,0 @@ "main": "./index", |
@@ -81,28 +81,3 @@ /// <reference types="node" /> | ||
recognizeUsingWebSocket(params: any): RecognizeStream; | ||
/** | ||
* Speech recognition for given audio using default model. | ||
* | ||
* @param {Object} params The parameters | ||
* @param {Stream} params.audio - Audio to be recognized | ||
* @param {String} [params.content_type] - Content-type | ||
* @param {String} [params.base_model_version] | ||
* @param {Number} [params.max_alternatives] | ||
* @param {Boolean} [params.timestamps] | ||
* @param {Boolean} [params.word_confidence] | ||
* @param {Number} [params.inactivity_timeout] | ||
* @param {String} [params.model] | ||
* @param {Boolean} [params.interim_results] | ||
* @param {Boolean} [params.keywords] | ||
* @param {Number} [params.keywords_threshold] | ||
* @param {Number} [params.word_alternatives_threshold] | ||
* @param {Boolean} [params.profanity_filter] | ||
* @param {Boolean} [params.smart_formatting] | ||
* @param {String} [params.language_customization_id] | ||
* @param {String} [params.customization_id] | ||
* @param {String} [params.acoustic_customization_id] | ||
* @param {Number} [params.customization_weight] | ||
* @param {Boolean} [params.speaker_labels] | ||
* @param {function} callback | ||
*/ | ||
recognize(params: any, callback: any): void; | ||
recognize(params: any, callback: any): void | NodeJS.ReadableStream; | ||
deleteCustomization(params: any, callback: any): void | NodeJS.ReadableStream; | ||
@@ -109,0 +84,0 @@ /** |
@@ -15,3 +15,2 @@ "use strict"; | ||
var isStream = require("isstream"); | ||
var pick = require("object.pick"); | ||
var url_1 = require("url"); | ||
@@ -425,69 +424,8 @@ var helper_1 = require("../lib/helper"); | ||
}; | ||
/** | ||
* Speech recognition for given audio using default model. | ||
* | ||
* @param {Object} params The parameters | ||
* @param {Stream} params.audio - Audio to be recognized | ||
* @param {String} [params.content_type] - Content-type | ||
* @param {String} [params.base_model_version] | ||
* @param {Number} [params.max_alternatives] | ||
* @param {Boolean} [params.timestamps] | ||
* @param {Boolean} [params.word_confidence] | ||
* @param {Number} [params.inactivity_timeout] | ||
* @param {String} [params.model] | ||
* @param {Boolean} [params.interim_results] | ||
* @param {Boolean} [params.keywords] | ||
* @param {Number} [params.keywords_threshold] | ||
* @param {Number} [params.word_alternatives_threshold] | ||
* @param {Boolean} [params.profanity_filter] | ||
* @param {Boolean} [params.smart_formatting] | ||
* @param {String} [params.language_customization_id] | ||
* @param {String} [params.customization_id] | ||
* @param {String} [params.acoustic_customization_id] | ||
* @param {Number} [params.customization_weight] | ||
* @param {Boolean} [params.speaker_labels] | ||
* @param {function} callback | ||
*/ | ||
SpeechToTextV1.prototype.recognize = function (params, callback) { | ||
var _this = this; | ||
var missingParams = helper_1.getMissingParams(params, ['audio']); | ||
if (missingParams) { | ||
callback(missingParams); | ||
if (params && params.audio && isStream(params.audio) && !params.content_type) { | ||
callback(new Error('If providing `audio` as a Stream, `content_type` is required.')); | ||
return; | ||
} | ||
if (!isStream(params.audio)) { | ||
callback(new Error('audio is not a standard Node.js Stream')); | ||
return; | ||
} | ||
var queryParams = pick(params, PARAMS_ALLOWED); | ||
if (Array.isArray(queryParams.keywords)) { | ||
queryParams.keywords = queryParams.keywords.join(','); | ||
} | ||
var _url = '/v1'; | ||
_url += params.session_id ? '/sessions/' + params.session_id : ''; | ||
_url += '/recognize'; | ||
var parameters = { | ||
options: { | ||
method: 'POST', | ||
url: _url, | ||
json: true, | ||
qs: queryParams | ||
}, | ||
defaultOptions: extend(true, {}, this._options, { | ||
headers: { | ||
'Content-Type': params.content_type | ||
} | ||
}) | ||
}; | ||
this.preAuthenticate(function (err) { | ||
if (err) { | ||
return err; | ||
} | ||
return params.audio | ||
.on('response', function (response) { | ||
// Replace content-type | ||
response.headers['content-type'] = params.content_type; | ||
}) | ||
.pipe(_this.createRequest(parameters, callback)); | ||
}); | ||
return _super.prototype.recognize.call(this, params, callback); | ||
}; | ||
@@ -494,0 +432,0 @@ SpeechToTextV1.prototype.deleteCustomization = function (params, callback) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7266876
126904