Skip to content

Commit f6a5af2

Browse files
Anwesha NaskarAnwesha Naskar
Anwesha Naskar
authored and
Anwesha Naskar
committed
This represents manual tweaks
1 parent fb721be commit f6a5af2

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

speech-to-text/v1-generated.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class SpeechToTextV1 extends BaseService {
148148
* @param {Function} [callback] - The callback that handles the response.
149149
* @returns {NodeJS.ReadableStream|void}
150150
*/
151-
public recognizeSessionless(params: SpeechToTextV1.RecognizeSessionlessParams, callback?: SpeechToTextV1.Callback<SpeechToTextV1.SpeechRecognitionResults>): NodeJS.ReadableStream | void {
151+
public recognize(params: SpeechToTextV1.RecognizeParams, callback?: SpeechToTextV1.Callback<SpeechToTextV1.SpeechRecognitionResults>): NodeJS.ReadableStream | void {
152152
const _params = extend({}, params);
153153
const _callback = (callback) ? callback : () => { /* noop */ };
154154
const requiredParams = ['audio', 'content_type'];
@@ -1696,14 +1696,14 @@ namespace SpeechToTextV1 {
16961696
headers?: Object;
16971697
}
16981698

1699-
/** Parameters for the `recognizeSessionless` operation. */
1700-
export interface RecognizeSessionlessParams {
1699+
/** Parameters for the `recognize` operation. */
1700+
export interface RecognizeParams {
17011701
/** The audio to transcribe in the format specified by the `Content-Type` header. */
17021702
audio: NodeJS.ReadableStream|FileObject|Buffer;
17031703
/** The type of the input: audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg, audio/ogg;codecs=opus, audio/ogg;codecs=vorbis, audio/wav, audio/webm, audio/webm;codecs=opus, or audio/webm;codecs=vorbis. */
1704-
content_type: RecognizeSessionlessConstants.ContentType | string;
1704+
content_type: RecognizeConstants.ContentType | string;
17051705
/** The identifier of the model that is to be used for the recognition request or, for the **Create a session** method, with the new session. */
1706-
model?: RecognizeSessionlessConstants.Model | string;
1706+
model?: RecognizeConstants.Model | string;
17071707
/** The customization ID (GUID) of a custom language model that is to be used with the recognition request or, for the **Create a session** method, with the new session. The base model of the specified custom language model must match the model specified with the `model` parameter. You must make the request with service credentials created for the instance of the service that owns the custom model. By default, no custom language model is used. */
17081708
customization_id?: string;
17091709
/** The customization ID (GUID) of a custom acoustic model that is to be used with the recognition request or, for the **Create a session** method, with the new session. The base model of the specified custom acoustic model must match the model specified with the `model` parameter. You must make the request with service credentials created for the instance of the service that owns the custom model. By default, no custom acoustic model is used. */
@@ -1735,8 +1735,8 @@ namespace SpeechToTextV1 {
17351735
headers?: Object;
17361736
}
17371737

1738-
/** Constants for the `recognizeSessionless` operation. */
1739-
export namespace RecognizeSessionlessConstants {
1738+
/** Constants for the `recognize` operation. */
1739+
export namespace RecognizeConstants {
17401740
/** The type of the input: audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg, audio/ogg;codecs=opus, audio/ogg;codecs=vorbis, audio/wav, audio/webm, audio/webm;codecs=opus, or audio/webm;codecs=vorbis. */
17411741
export enum ContentType {
17421742
BASIC = 'audio/basic',

text-to-speech/v1-generated.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import * as extend from 'extend';
1818
import { RequestResponse } from 'request';
1919
import { BaseService } from '../lib/base_service';
2020
import { getMissingParams } from '../lib/helper';
21+
import { FileObject } from '../lib/helper';
2122

2223
/**
2324
* ### Service Overview The IBM&reg; Text to Speech service provides an API that uses IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one male or female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay. For more information about the service, see the [IBM&reg; Cloud documentation](https://console.bluemix.net/docs/services/text-to-speech/getting-started.html). ### API Overview The Text to Speech service provides the following endpoints: * **Voices** provides information about the voices available for synthesized speech. * **Synthesis** synthesizes written text to audio speech. * **Pronunciation** returns the pronunciation for a specified word. Currently a beta feature. * **Custom models** and let users create custom voice models, which are dictionaries of words and their translations for use in speech synthesis. All custom model methods are currently beta features. * **Custom words** let users manage the words in a custom voice model. All custom word methods are currently beta features. ### API Usage The following information provides details about using the service to synthesize audio: * **Audio formats:** The service supports a number of audio formats (MIME types). For more information about audio formats and sampling rates, including links to a number of Internet sites that provide technical and usage details about the different formats, see [Specifying an audio format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format). * **SSML:** Many methods refer to the Speech Synthesis Markup Language (SSML), an XML-based markup language that provides annotations of text for speech-synthesis applications; for example, many methods accept or produce translations that use an SSML-based phoneme format. See [Using SSML](https://console.bluemix.net/docs/services/text-to-speech/SSML.html) and [Using IBM SPR](https://console.bluemix.net/docs/services/text-to-speech/SPRs.html). * **Word translations:** Many customization methods accept or return sounds-like or phonetic translations for words. A phonetic translation is based on the SSML format for representing the phonetic string of a word. Phonetic translations can use standard International Phonetic Alphabet (IPA) representation: &lt;phoneme alphabet=\"ipa\" ph=\"t&#601;m&#712;&#593;to\"&gt;&lt;/phoneme&gt; or the proprietary IBM Symbolic Phonetic Representation (SPR): &lt;phoneme alphabet=\"ibm\" ph=\"1gAstroEntxrYFXs\"&gt;&lt;/phoneme&gt; For more information about customization and about sounds-like and phonetic translations, see [Understanding customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html). * **WebSocket interface:** The service also offers a WebSocket interface as an alternative to its HTTP REST interface for speech synthesis. The WebSocket interface supports both plain text and SSML input, including the SSML &lt;mark&gt; element and word timings. See [The WebSocket interface](https://console.bluemix.net/docs/services/text-to-speech/websockets.html). * **GUIDs:** The pronunciation and customization methods accept or return a Globally Unique Identifier (GUID). For example, customization IDs (specified with the `customization_id` parameter) and service credentials are GUIDs. GUIDs are hexadecimal strings that have the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. * **Custom voice model ownership:** In all cases, you must use service credentials created for the instance of the service that owns a custom voice model to use the methods described in this documentation with that model. For more information, see [Ownership of custom voice models](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#customOwner). * **`X-Watson-Metadata`**: This header allows you to associate a customer ID with personal data that is passed with a request. For more information, see [Information security](https://console.bluemix.net/docs/services/text-to-speech/information-security.html).
@@ -137,7 +138,7 @@ class TextToSpeechV1 extends BaseService {
137138
* @param {Function} [callback] - The callback that handles the response.
138139
* @returns {NodeJS.ReadableStream|void}
139140
*/
140-
public synthesize(params: TextToSpeechV1.SynthesizeParams, callback?: TextToSpeechV1.Callback<TextToSpeechV1.NodeJS.ReadableStream|FileObject|Buffer>): NodeJS.ReadableStream | void {
141+
public synthesize(params: TextToSpeechV1.SynthesizeParams, callback?: TextToSpeechV1.Callback<NodeJS.ReadableStream|FileObject|Buffer>): NodeJS.ReadableStream | void {
141142
const _params = extend({}, params);
142143
const _callback = (callback) ? callback : () => { /* noop */ };
143144
const requiredParams = ['text'];
@@ -159,6 +160,7 @@ class TextToSpeechV1 extends BaseService {
159160
json: true,
160161
body,
161162
qs: query,
163+
encoding: null,
162164
},
163165
defaultOptions: extend(true, {}, this._options, {
164166
headers: extend(true, {

visual-recognition/v3-generated.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ class VisualRecognitionV3 extends BaseService {
167167
public createClassifier(params: VisualRecognitionV3.CreateClassifierParams, callback?: VisualRecognitionV3.Callback<VisualRecognitionV3.Classifier>): NodeJS.ReadableStream | void {
168168
const _params = extend({}, params);
169169
const _callback = (callback) ? callback : () => { /* noop */ };
170-
const requiredParams = ['name', 'classname_positive_examples'];
170+
const positiveExampleClasses = Object.keys(_params).filter(key => {
171+
return key.match(/^.+positive_examples$/);
172+
}) || ['<classname>_positive_examples'];
173+
const requiredParams = ['name', ...positiveExampleClasses];
171174
const missingParams = getMissingParams(_params, requiredParams);
172175
if (missingParams) {
173176
return _callback(missingParams);
@@ -183,6 +186,12 @@ class VisualRecognitionV3 extends BaseService {
183186
contentType: 'application/octet-stream'
184187
}
185188
};
189+
positiveExampleClasses.forEach(positiveExampleClass => {
190+
formData[positiveExampleClass] = {
191+
data: _params[positiveExampleClass],
192+
contentType: 'application/octet-stream',
193+
};
194+
});
186195
const parameters = {
187196
options: {
188197
url: '/v3/classifiers',
@@ -320,6 +329,9 @@ class VisualRecognitionV3 extends BaseService {
320329
public updateClassifier(params: VisualRecognitionV3.UpdateClassifierParams, callback?: VisualRecognitionV3.Callback<VisualRecognitionV3.Classifier>): NodeJS.ReadableStream | void {
321330
const _params = extend({}, params);
322331
const _callback = (callback) ? callback : () => { /* noop */ };
332+
const positiveExampleClasses = Object.keys(_params).filter(key => {
333+
return key.match(/^.+positive_examples$/);
334+
});
323335
const requiredParams = ['classifier_id'];
324336
const missingParams = getMissingParams(_params, requiredParams);
325337
if (missingParams) {
@@ -338,6 +350,12 @@ class VisualRecognitionV3 extends BaseService {
338350
const path = {
339351
'classifier_id': _params.classifier_id
340352
};
353+
positiveExampleClasses.forEach(positiveExampleClass => {
354+
formData[positiveExampleClass] = {
355+
data: _params[positiveExampleClass],
356+
contentType: 'application/octet-stream',
357+
};
358+
});
341359
const parameters = {
342360
options: {
343361
url: '/v3/classifiers/{classifier_id}',
@@ -370,7 +388,7 @@ class VisualRecognitionV3 extends BaseService {
370388
* @param {Function} [callback] - The callback that handles the response.
371389
* @returns {NodeJS.ReadableStream|void}
372390
*/
373-
public getCoreMlModel(params: VisualRecognitionV3.GetCoreMlModelParams, callback?: VisualRecognitionV3.Callback<VisualRecognitionV3.NodeJS.ReadableStream|FileObject|Buffer>): NodeJS.ReadableStream | void {
391+
public getCoreMlModel(params: VisualRecognitionV3.GetCoreMlModelParams, callback?: VisualRecognitionV3.Callback<NodeJS.ReadableStream|FileObject|Buffer>): NodeJS.ReadableStream | void {
374392
const _params = extend({}, params);
375393
const _callback = (callback) ? callback : () => { /* noop */ };
376394
const requiredParams = ['classifier_id'];

0 commit comments

Comments
 (0)