ibm_watson 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,16 +57,16 @@ module IBMWatson
57
57
  # @param args [Hash] The args to initialize with
58
58
  # @option args url [String] The base url to use when contacting the service (e.g.
59
59
  # "https://stream.watsonplatform.net/speech-to-text/api").
60
- # The base url may differ between Bluemix regions.
60
+ # The base url may differ between IBM Cloud regions.
61
61
  # @option args username [String] The username used to authenticate with the service.
62
62
  # Username and password credentials are only required to run your
63
- # application locally or outside of Bluemix. When running on
64
- # Bluemix, the credentials will be automatically loaded from the
63
+ # application locally or outside of IBM Cloud. When running on
64
+ # IBM Cloud, the credentials will be automatically loaded from the
65
65
  # `VCAP_SERVICES` environment variable.
66
66
  # @option args password [String] The password used to authenticate with the service.
67
67
  # Username and password credentials are only required to run your
68
- # application locally or outside of Bluemix. When running on
69
- # Bluemix, the credentials will be automatically loaded from the
68
+ # application locally or outside of IBM Cloud. When running on
69
+ # IBM Cloud, the credentials will be automatically loaded from the
70
70
  # `VCAP_SERVICES` environment variable.
71
71
  # @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
72
72
  # this API key is provided, the SDK will manage the token and handle the
@@ -76,7 +76,9 @@ module IBMWatson
76
76
  # it expires or reactively upon receiving a 401 from the service as any requests
77
77
  # made with an expired token will fail.
78
78
  # @option args iam_url [String] An optional URL for the IAM service API. Defaults to
79
- # 'https://iam.ng.bluemix.net/identity/token'.
79
+ # 'https://iam.cloud.ibm.com/identity/token'.
80
+ # @option args iam_client_id [String] An optional client id for the IAM service API.
81
+ # @option args iam_client_secret [String] An optional client secret for the IAM service API.
80
82
  def initialize(args = {})
81
83
  @__async_initialized__ = false
82
84
  defaults = {}
@@ -86,6 +88,8 @@ module IBMWatson
86
88
  defaults[:iam_apikey] = nil
87
89
  defaults[:iam_access_token] = nil
88
90
  defaults[:iam_url] = nil
91
+ defaults[:iam_client_id] = nil
92
+ defaults[:iam_client_secret] = nil
89
93
  args = defaults.merge(args)
90
94
  args[:vcap_services_name] = "speech_to_text"
91
95
  super
@@ -97,26 +101,22 @@ module IBMWatson
97
101
  #########################
98
102
 
99
103
  ##
100
- # @!method get_model(model_id:)
101
- # Get a model.
102
- # Gets information for a single specified language model that is available for use
103
- # with the service. The information includes the name of the model and its minimum
104
- # sampling rate in Hertz, among other things.
104
+ # @!method list_models
105
+ # List models.
106
+ # Lists all language models that are available for use with the service. The
107
+ # information includes the name of the model and its minimum sampling rate in Hertz,
108
+ # among other things.
105
109
  #
106
110
  # **See also:** [Languages and
107
- # models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
108
- # @param model_id [String] The identifier of the model in the form of its name from the output of the **Get a
109
- # model** method.
111
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models#models).
110
112
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
111
- def get_model(model_id:)
112
- raise ArgumentError.new("model_id must be provided") if model_id.nil?
113
-
113
+ def list_models
114
114
  headers = {
115
115
  }
116
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "get_model")
116
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_models")
117
117
  headers.merge!(sdk_headers)
118
118
 
119
- method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
119
+ method_url = "/v1/models"
120
120
 
121
121
  response = request(
122
122
  method: "GET",
@@ -128,22 +128,26 @@ module IBMWatson
128
128
  end
129
129
 
130
130
  ##
131
- # @!method list_models
132
- # List models.
133
- # Lists all language models that are available for use with the service. The
134
- # information includes the name of the model and its minimum sampling rate in Hertz,
135
- # among other things.
131
+ # @!method get_model(model_id:)
132
+ # Get a model.
133
+ # Gets information for a single specified language model that is available for use
134
+ # with the service. The information includes the name of the model and its minimum
135
+ # sampling rate in Hertz, among other things.
136
136
  #
137
137
  # **See also:** [Languages and
138
- # models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
138
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models#models).
139
+ # @param model_id [String] The identifier of the model in the form of its name from the output of the **Get a
140
+ # model** method.
139
141
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
140
- def list_models
142
+ def get_model(model_id:)
143
+ raise ArgumentError.new("model_id must be provided") if model_id.nil?
144
+
141
145
  headers = {
142
146
  }
143
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_models")
147
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "get_model")
144
148
  headers.merge!(sdk_headers)
145
149
 
146
- method_url = "/v1/models"
150
+ method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
147
151
 
148
152
  response = request(
149
153
  method: "GET",
@@ -158,17 +162,18 @@ module IBMWatson
158
162
  #########################
159
163
 
160
164
  ##
161
- # @!method recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, content_type: nil)
165
+ # @!method recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, audio_metrics: nil, content_type: nil)
162
166
  # Recognize audio.
163
167
  # Sends audio and returns transcription results for a recognition request. You can
164
168
  # pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The
165
169
  # service automatically detects the endianness of the incoming audio and, for audio
166
170
  # that includes multiple channels, downmixes the audio to one-channel mono during
167
171
  # transcoding. The method returns only final results; to enable interim results, use
168
- # the WebSocket API.
172
+ # the WebSocket API. (With the `curl` command, use the `--data-binary` option to
173
+ # upload the file for the request.)
169
174
  #
170
175
  # **See also:** [Making a basic HTTP
171
- # request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-basic).
176
+ # request](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-http#HTTP-basic).
172
177
  #
173
178
  #
174
179
  # ### Streaming mode
@@ -183,9 +188,9 @@ module IBMWatson
183
188
  #
184
189
  # **See also:**
185
190
  # * [Audio
186
- # transmission](https://cloud.ibm.com/docs/services/speech-to-text/input.html#transmission)
191
+ # transmission](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#transmission)
187
192
  # *
188
- # [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts)
193
+ # [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#timeouts)
189
194
  #
190
195
  #
191
196
  # ### Audio formats (content types)
@@ -225,7 +230,8 @@ module IBMWatson
225
230
  # fails.
226
231
  #
227
232
  # **See also:** [Audio
228
- # formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
233
+ # formats](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-audio-formats#audio-formats).
234
+ #
229
235
  #
230
236
  # ### Multipart speech recognition
231
237
  #
@@ -234,25 +240,26 @@ module IBMWatson
234
240
  # The HTTP `POST` method of the service also supports multipart speech recognition.
235
241
  # With multipart requests, you pass all audio data as multipart form data. You
236
242
  # specify some parameters as request headers and query parameters, but you pass JSON
237
- # metadata as form data to control most aspects of the transcription.
243
+ # metadata as form data to control most aspects of the transcription. You can use
244
+ # multipart recognition to pass multiple audio files with a single request.
238
245
  #
239
- # The multipart approach is intended for use with browsers for which JavaScript is
240
- # disabled or when the parameters used with the request are greater than the 8 KB
241
- # limit imposed by most HTTP servers and proxies. You can encounter this limit, for
242
- # example, if you want to spot a very large number of keywords.
246
+ # Use the multipart approach with browsers for which JavaScript is disabled or when
247
+ # the parameters used with the request are greater than the 8 KB limit imposed by
248
+ # most HTTP servers and proxies. You can encounter this limit, for example, if you
249
+ # want to spot a very large number of keywords.
243
250
  #
244
251
  # **See also:** [Making a multipart HTTP
245
- # request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-multi).
252
+ # request](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-http#HTTP-multi).
246
253
  # @param audio [String] The audio to transcribe.
247
254
  # @param model [String] The identifier of the model that is to be used for the recognition request. See
248
255
  # [Languages and
249
- # models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
256
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models#models).
250
257
  # @param language_customization_id [String] The customization ID (GUID) of a custom language model that is to be used with the
251
258
  # recognition request. The base model of the specified custom language model must
252
259
  # match the model specified with the `model` parameter. You must make the request
253
260
  # with credentials for the instance of the service that owns the custom model. By
254
261
  # default, no custom language model is used. See [Custom
255
- # models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
262
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#custom-input).
256
263
  #
257
264
  #
258
265
  # **Note:** Use this parameter instead of the deprecated `customization_id`
@@ -262,13 +269,13 @@ module IBMWatson
262
269
  # match the model specified with the `model` parameter. You must make the request
263
270
  # with credentials for the instance of the service that owns the custom model. By
264
271
  # default, no custom acoustic model is used. See [Custom
265
- # models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
266
- # @param base_model_version [String] The version of the specified base model that is to be used with recognition
272
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#custom-input).
273
+ # @param base_model_version [String] The version of the specified base model that is to be used with the recognition
267
274
  # request. Multiple versions of a base model can exist when a model is updated for
268
275
  # internal improvements. The parameter is intended primarily for use with custom
269
276
  # models that have been upgraded for a new base model. The default value depends on
270
277
  # whether the parameter is used with or without a custom model. See [Base model
271
- # version](https://cloud.ibm.com/docs/services/speech-to-text/input.html#version).
278
+ # version](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#version).
272
279
  # @param customization_weight [Float] If you specify the customization ID (GUID) of a custom language model with the
273
280
  # recognition request, the customization weight tells the service how much weight to
274
281
  # give to words from the custom language model compared to those from the base model
@@ -286,45 +293,45 @@ module IBMWatson
286
293
  # phrases.
287
294
  #
288
295
  # See [Custom
289
- # models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
296
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#custom-input).
290
297
  # @param inactivity_timeout [Fixnum] The time in seconds after which, if only silence (no speech) is detected in
291
298
  # streaming audio, the connection is closed with a 400 error. The parameter is
292
299
  # useful for stopping audio submission from a live microphone when a user simply
293
300
  # walks away. Use `-1` for infinity. See [Inactivity
294
- # timeout](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts-inactivity).
301
+ # timeout](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#timeouts-inactivity).
295
302
  # @param keywords [Array[String]] An array of keyword strings to spot in the audio. Each keyword string can include
296
303
  # one or more string tokens. Keywords are spotted only in the final results, not in
297
304
  # interim hypotheses. If you specify any keywords, you must also specify a keywords
298
305
  # threshold. You can spot a maximum of 1000 keywords. Omit the parameter or specify
299
306
  # an empty array if you do not need to spot keywords. See [Keyword
300
- # spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
307
+ # spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#keyword_spotting).
301
308
  # @param keywords_threshold [Float] A confidence value that is the lower bound for spotting a keyword. A word is
302
309
  # considered to match a keyword if its confidence is greater than or equal to the
303
310
  # threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold,
304
311
  # you must also specify one or more keywords. The service performs no keyword
305
312
  # spotting if you omit either parameter. See [Keyword
306
- # spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
313
+ # spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#keyword_spotting).
307
314
  # @param max_alternatives [Fixnum] The maximum number of alternative transcripts that the service is to return. By
308
315
  # default, the service returns a single transcript. If you specify a value of `0`,
309
316
  # the service uses the default value, `1`. See [Maximum
310
- # alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#max_alternatives).
317
+ # alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#max_alternatives).
311
318
  # @param word_alternatives_threshold [Float] A confidence value that is the lower bound for identifying a hypothesis as a
312
319
  # possible word alternative (also known as \"Confusion Networks\"). An alternative
313
320
  # word is considered if its confidence is greater than or equal to the threshold.
314
321
  # Specify a probability between 0.0 and 1.0. By default, the service computes no
315
322
  # alternative words. See [Word
316
- # alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_alternatives).
323
+ # alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#word_alternatives).
317
324
  # @param word_confidence [Boolean] If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for
318
325
  # each word. By default, the service returns no word confidence scores. See [Word
319
- # confidence](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_confidence).
326
+ # confidence](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#word_confidence).
320
327
  # @param timestamps [Boolean] If `true`, the service returns time alignment for each word. By default, no
321
328
  # timestamps are returned. See [Word
322
- # timestamps](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_timestamps).
329
+ # timestamps](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#word_timestamps).
323
330
  # @param profanity_filter [Boolean] If `true`, the service filters profanity from all output except for keyword
324
331
  # results by replacing inappropriate words with a series of asterisks. Set the
325
332
  # parameter to `false` to return results with no censoring. Applies to US English
326
333
  # transcription only. See [Profanity
327
- # filtering](https://cloud.ibm.com/docs/services/speech-to-text/output.html#profanity_filter).
334
+ # filtering](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#profanity_filter).
328
335
  # @param smart_formatting [Boolean] If `true`, the service converts dates, times, series of digits and numbers, phone
329
336
  # numbers, currency values, and internet addresses into more readable, conventional
330
337
  # representations in the final transcript of a recognition request. For US English,
@@ -334,7 +341,7 @@ module IBMWatson
334
341
  # **Note:** Applies to US English, Japanese, and Spanish transcription only.
335
342
  #
336
343
  # See [Smart
337
- # formatting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#smart_formatting).
344
+ # formatting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#smart_formatting).
338
345
  # @param speaker_labels [Boolean] If `true`, the response includes labels that identify which words were spoken by
339
346
  # which participants in a multi-person exchange. By default, the service returns no
340
347
  # speaker labels. Setting `speaker_labels` to `true` forces the `timestamps`
@@ -347,7 +354,7 @@ module IBMWatson
347
354
  # `true`.
348
355
  #
349
356
  # See [Speaker
350
- # labels](https://cloud.ibm.com/docs/services/speech-to-text/output.html#speaker_labels).
357
+ # labels](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#speaker_labels).
351
358
  # @param customization_id [String] **Deprecated.** Use the `language_customization_id` parameter to specify the
352
359
  # customization ID (GUID) of a custom language model that is to be used with the
353
360
  # recognition request. Do not specify both parameters with a request.
@@ -356,7 +363,7 @@ module IBMWatson
356
363
  # specify the name of the custom language model for which the grammar is defined.
357
364
  # The service recognizes only strings that are recognized by the specified grammar;
358
365
  # it does not recognize other custom words from the model's words resource. See
359
- # [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/input.html#grammars-input).
366
+ # [Grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#grammars-input).
360
367
  # @param redaction [Boolean] If `true`, the service redacts, or masks, numeric data from final transcripts. The
361
368
  # feature redacts any number that has three or more consecutive digits by replacing
362
369
  # each digit with an `X` character. It is intended to redact sensitive numeric data,
@@ -371,11 +378,17 @@ module IBMWatson
371
378
  # **Note:** Applies to US English, Japanese, and Korean transcription only.
372
379
  #
373
380
  # See [Numeric
374
- # redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
381
+ # redaction](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#redaction).
382
+ # The parameter accepts a minimum value of 0.1 seconds. The level of precision is
383
+ # not restricted, so you can specify values such as 0.25 and 0.125.
384
+ #
385
+ # @param audio_metrics [Boolean] If `true`, requests detailed information about the signal characteristics of the
386
+ # input audio. The service returns audio metrics with the final transcription
387
+ # results. By default, the service returns no audio metrics.
375
388
  # @param content_type [String] The format (MIME type) of the audio. For more information about specifying an
376
389
  # audio format, see **Audio formats (content types)** in the method description.
377
390
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
378
- def recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, content_type: nil)
391
+ def recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, audio_metrics: nil, content_type: nil)
379
392
  raise ArgumentError.new("audio must be provided") if audio.nil?
380
393
 
381
394
  headers = {
@@ -403,7 +416,8 @@ module IBMWatson
403
416
  "speaker_labels" => speaker_labels,
404
417
  "customization_id" => customization_id,
405
418
  "grammar_name" => grammar_name,
406
- "redaction" => redaction
419
+ "redaction" => redaction,
420
+ "audio_metrics" => audio_metrics
407
421
  }
408
422
 
409
423
  data = audio
@@ -422,7 +436,7 @@ module IBMWatson
422
436
  end
423
437
 
424
438
  ##
425
- # @!method recognize_using_websocket(content_type:,recognize_callback:,audio: nil,chunk_data: false,model: nil,customization_id: nil,acoustic_customization_id: nil,customization_weight: nil,base_model_version: nil,inactivity_timeout: nil,interim_results: nil,keywords: nil,keywords_threshold: nil,max_alternatives: nil,word_alternatives_threshold: nil,word_confidence: nil,timestamps: nil,profanity_filter: nil,smart_formatting: nil,speaker_labels: nil)
439
+ # @!method recognize_using_websocket(content_type: nil,recognize_callback:,audio: nil,chunk_data: false,model: nil,customization_id: nil,acoustic_customization_id: nil,customization_weight: nil,base_model_version: nil,inactivity_timeout: nil,interim_results: nil,keywords: nil,keywords_threshold: nil,max_alternatives: nil,word_alternatives_threshold: nil,word_confidence: nil,timestamps: nil,profanity_filter: nil,smart_formatting: nil,speaker_labels: nil)
426
440
  # Sends audio for speech recognition using web sockets.
427
441
  # @param content_type [String] 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, audio/webm;codecs=vorbis, or multipart/form-data.
428
442
  # @param recognize_callback [RecognizeCallback] The instance handling events returned from the service.
@@ -432,7 +446,6 @@ module IBMWatson
432
446
  # @param customization_id [String] The GUID of a custom language model that is to be used with the request. 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.
433
447
  # @param acoustic_customization_id [String] The GUID of a custom acoustic model that is to be used with the request. 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.
434
448
  # @param language_customization_id [String] The GUID of a custom language model that is to be used with the request. 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.
435
- # @param customization_weight [Float] If you specify a `customization_id` with the request, you can use the `customization_weight` parameter to tell the service how much weight to give to words from the custom language model compared to those from the base model for speech recognition. Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for the custom model when it was trained, the default value is 0.3. A customization weight that you specify overrides a weight that was specified when the custom model was trained. The default value yields the best performance in general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it can negatively affect performance on non-domain phrases.
436
449
  # @param base_model_version [String] The version of the specified base `model` that is to be used for speech recognition. Multiple versions of a base model can exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom models that have been upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. For more information, see [Base model version](https://console.bluemix.net/docs/services/speech-to-text/input.html#version).
437
450
  # @param inactivity_timeout [Integer] The time in seconds after which, if only silence (no speech) is detected in submitted audio, the connection is closed with a 400 error. Useful for stopping audio submission from a live microphone when a user simply walks away. Use `-1` for infinity.
438
451
  # @param interim_results [Boolean] Send back non-final previews of each "sentence" as it is being processed. These results are ignored in text mode.
@@ -466,6 +479,24 @@ module IBMWatson
466
479
  #
467
480
  # See [Numeric
468
481
  # redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
482
+ #
483
+ # @param processing_metrics [Boolean] If `true`, requests processing metrics about the service's transcription of the
484
+ # input audio. The service returns processing metrics at the interval specified by
485
+ # the `processing_metrics_interval` parameter. It also returns processing metrics
486
+ # for transcription events, for example, for final and interim results. By default,
487
+ # the service returns no processing metrics.
488
+ # @param processing_metrics_interval [Float] Specifies the interval in real wall-clock seconds at which the service is to
489
+ # return processing metrics. The parameter is ignored unless the
490
+ # `processing_metrics` parameter is set to `true`. # The parameter accepts a minimum value of 0.1 seconds. The level of precision is
491
+ # not restricted, so you can specify values such as 0.25 and 0.125.
492
+ #
493
+ # The service does not impose a maximum value. If you want to receive processing
494
+ # metrics only for transcription events instead of at periodic intervals, set the
495
+ # value to a large number. If the value is larger than the duration of the audio,
496
+ # the service returns processing metrics only for transcription events.
497
+ # @param audio_metrics [Boolean] If `true`, requests detailed information about the signal characteristics of the
498
+ # input audio. The service returns audio metrics with the final transcription
499
+ # results. By default, the service returns no audio metrics.
469
500
  # @return [WebSocketClient] Returns a new WebSocketClient object
470
501
  def recognize_using_websocket(
471
502
  content_type: nil,
@@ -490,7 +521,10 @@ module IBMWatson
490
521
  smart_formatting: nil,
491
522
  speaker_labels: nil,
492
523
  grammar_name: nil,
493
- redaction: nil
524
+ redaction: nil,
525
+ processing_metrics: nil,
526
+ processing_metrics_interval: nil,
527
+ audio_metrics: nil
494
528
  )
495
529
  raise ArgumentError("Audio must be provided") if audio.nil? && !chunk_data
496
530
  raise ArgumentError("Recognize callback must be provided") if recognize_callback.nil?
@@ -530,7 +564,10 @@ module IBMWatson
530
564
  "smart_formatting" => smart_formatting,
531
565
  "speaker_labels" => speaker_labels,
532
566
  "grammar_name" => grammar_name,
533
- "redaction" => redaction
567
+ "redaction" => redaction,
568
+ "processing_metrics" => processing_metrics,
569
+ "processing_metrics_interval" => processing_metrics_interval,
570
+ "audio_metrics" => audio_metrics
534
571
  }
535
572
  options.delete_if { |_, v| v.nil? }
536
573
  WebSocketClient.new(audio: audio, chunk_data: chunk_data, options: options, recognize_callback: recognize_callback, url: url, headers: headers, disable_ssl_verification: @disable_ssl_verification)
@@ -590,79 +627,115 @@ module IBMWatson
590
627
  #########################
591
628
 
592
629
  ##
593
- # @!method check_job(id:)
594
- # Check a job.
595
- # Returns information about the specified job. The response always includes the
596
- # status of the job and its creation and update times. If the status is `completed`,
597
- # the response includes the results of the recognition request. You must use
598
- # credentials for the instance of the service that owns a job to list information
599
- # about it.
630
+ # @!method register_callback(callback_url:, user_secret: nil)
631
+ # Register a callback.
632
+ # Registers a callback URL with the service for use with subsequent asynchronous
633
+ # recognition requests. The service attempts to register, or white-list, the
634
+ # callback URL if it is not already registered by sending a `GET` request to the
635
+ # callback URL. The service passes a random alphanumeric challenge string via the
636
+ # `challenge_string` parameter of the request. The request includes an `Accept`
637
+ # header that specifies `text/plain` as the required response type.
600
638
  #
601
- # You can use the method to retrieve the results of any job, regardless of whether
602
- # it was submitted with a callback URL and the `recognitions.completed_with_results`
603
- # event, and you can retrieve the results multiple times for as long as they remain
604
- # available. Use the **Check jobs** method to request information about the most
605
- # recent jobs associated with the calling credentials.
639
+ # To be registered successfully, the callback URL must respond to the `GET` request
640
+ # from the service. The response must send status code 200 and must include the
641
+ # challenge string in its body. Set the `Content-Type` response header to
642
+ # `text/plain`. Upon receiving this response, the service responds to the original
643
+ # registration request with response code 201.
606
644
  #
607
- # **See also:** [Checking the status and retrieving the results of a
608
- # job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#job).
609
- # @param id [String] The identifier of the asynchronous job that is to be used for the request. You
610
- # must make the request with credentials for the instance of the service that owns
611
- # the job.
645
+ # The service sends only a single `GET` request to the callback URL. If the service
646
+ # does not receive a reply with a response code of 200 and a body that echoes the
647
+ # challenge string sent by the service within five seconds, it does not white-list
648
+ # the URL; it instead sends status code 400 in response to the **Register a
649
+ # callback** request. If the requested callback URL is already white-listed, the
650
+ # service responds to the initial registration request with response code 200.
651
+ #
652
+ # If you specify a user secret with the request, the service uses it as a key to
653
+ # calculate an HMAC-SHA1 signature of the challenge string in its response to the
654
+ # `POST` request. It sends this signature in the `X-Callback-Signature` header of
655
+ # its `GET` request to the URL during registration. It also uses the secret to
656
+ # calculate a signature over the payload of every callback notification that uses
657
+ # the URL. The signature provides authentication and data integrity for HTTP
658
+ # communications.
659
+ #
660
+ # After you successfully register a callback URL, you can use it with an indefinite
661
+ # number of recognition requests. You can register a maximum of 20 callback URLS in
662
+ # a one-hour span of time.
663
+ #
664
+ # **See also:** [Registering a callback
665
+ # URL](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-async#register).
666
+ # @param callback_url [String] An HTTP or HTTPS URL to which callback notifications are to be sent. To be
667
+ # white-listed, the URL must successfully echo the challenge string during URL
668
+ # verification. During verification, the client can also check the signature that
669
+ # the service sends in the `X-Callback-Signature` header to verify the origin of the
670
+ # request.
671
+ # @param user_secret [String] A user-specified string that the service uses to generate the HMAC-SHA1 signature
672
+ # that it sends via the `X-Callback-Signature` header. The service includes the
673
+ # header during URL verification and with every notification sent to the callback
674
+ # URL. It calculates the signature over the payload of the notification. If you omit
675
+ # the parameter, the service does not send the header.
612
676
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
613
- def check_job(id:)
614
- raise ArgumentError.new("id must be provided") if id.nil?
677
+ def register_callback(callback_url:, user_secret: nil)
678
+ raise ArgumentError.new("callback_url must be provided") if callback_url.nil?
615
679
 
616
680
  headers = {
617
681
  }
618
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "check_job")
682
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "register_callback")
619
683
  headers.merge!(sdk_headers)
620
684
 
621
- method_url = "/v1/recognitions/%s" % [ERB::Util.url_encode(id)]
685
+ params = {
686
+ "callback_url" => callback_url,
687
+ "user_secret" => user_secret
688
+ }
689
+
690
+ method_url = "/v1/register_callback"
622
691
 
623
692
  response = request(
624
- method: "GET",
693
+ method: "POST",
625
694
  url: method_url,
626
695
  headers: headers,
696
+ params: params,
627
697
  accept_json: true
628
698
  )
629
699
  response
630
700
  end
631
701
 
632
702
  ##
633
- # @!method check_jobs
634
- # Check jobs.
635
- # Returns the ID and status of the latest 100 outstanding jobs associated with the
636
- # credentials with which it is called. The method also returns the creation and
637
- # update times of each job, and, if a job was created with a callback URL and a user
638
- # token, the user token for the job. To obtain the results for a job whose status is
639
- # `completed` or not one of the latest 100 outstanding jobs, use the **Check a job**
640
- # method. A job and its results remain available until you delete them with the
641
- # **Delete a job** method or until the job's time to live expires, whichever comes
642
- # first.
703
+ # @!method unregister_callback(callback_url:)
704
+ # Unregister a callback.
705
+ # Unregisters a callback URL that was previously white-listed with a **Register a
706
+ # callback** request for use with the asynchronous interface. Once unregistered, the
707
+ # URL can no longer be used with asynchronous recognition requests.
643
708
  #
644
- # **See also:** [Checking the status of the latest
645
- # jobs](https://cloud.ibm.com/docs/services/speech-to-text/async.html#jobs).
646
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
647
- def check_jobs
709
+ # **See also:** [Unregistering a callback
710
+ # URL](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-async#unregister).
711
+ # @param callback_url [String] The callback URL that is to be unregistered.
712
+ # @return [nil]
713
+ def unregister_callback(callback_url:)
714
+ raise ArgumentError.new("callback_url must be provided") if callback_url.nil?
715
+
648
716
  headers = {
649
717
  }
650
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "check_jobs")
718
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "unregister_callback")
651
719
  headers.merge!(sdk_headers)
652
720
 
653
- method_url = "/v1/recognitions"
721
+ params = {
722
+ "callback_url" => callback_url
723
+ }
654
724
 
655
- response = request(
656
- method: "GET",
725
+ method_url = "/v1/unregister_callback"
726
+
727
+ request(
728
+ method: "POST",
657
729
  url: method_url,
658
730
  headers: headers,
659
- accept_json: true
731
+ params: params,
732
+ accept_json: false
660
733
  )
661
- response
734
+ nil
662
735
  end
663
736
 
664
737
  ##
665
- # @!method create_job(audio:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, content_type: nil)
738
+ # @!method create_job(audio:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, audio_metrics: nil, content_type: nil)
666
739
  # Create a job.
667
740
  # Creates a job for a new asynchronous recognition request. The job is owned by the
668
741
  # instance of the service whose credentials are used to create it. How you learn the
@@ -698,10 +771,12 @@ module IBMWatson
698
771
  # The service automatically detects the endianness of the incoming audio and, for
699
772
  # audio that includes multiple channels, downmixes the audio to one-channel mono
700
773
  # during transcoding. The method returns only final results; to enable interim
701
- # results, use the WebSocket API.
774
+ # results, use the WebSocket API. (With the `curl` command, use the `--data-binary`
775
+ # option to upload the file for the request.)
702
776
  #
703
777
  # **See also:** [Creating a
704
- # job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#create).
778
+ # job](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-async#create).
779
+ #
705
780
  #
706
781
  # ### Streaming mode
707
782
  #
@@ -715,9 +790,9 @@ module IBMWatson
715
790
  #
716
791
  # **See also:**
717
792
  # * [Audio
718
- # transmission](https://cloud.ibm.com/docs/services/speech-to-text/input.html#transmission)
793
+ # transmission](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#transmission)
719
794
  # *
720
- # [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts)
795
+ # [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#timeouts)
721
796
  #
722
797
  #
723
798
  # ### Audio formats (content types)
@@ -757,11 +832,11 @@ module IBMWatson
757
832
  # fails.
758
833
  #
759
834
  # **See also:** [Audio
760
- # formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
835
+ # formats](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-audio-formats#audio-formats).
761
836
  # @param audio [String] The audio to transcribe.
762
837
  # @param model [String] The identifier of the model that is to be used for the recognition request. See
763
838
  # [Languages and
764
- # models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
839
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models#models).
765
840
  # @param callback_url [String] A URL to which callback notifications are to be sent. The URL must already be
766
841
  # successfully white-listed by using the **Register a callback** method. You can
767
842
  # include the same callback URL with any number of job creation requests. Omit the
@@ -801,7 +876,7 @@ module IBMWatson
801
876
  # match the model specified with the `model` parameter. You must make the request
802
877
  # with credentials for the instance of the service that owns the custom model. By
803
878
  # default, no custom language model is used. See [Custom
804
- # models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
879
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#custom-input).
805
880
  #
806
881
  #
807
882
  # **Note:** Use this parameter instead of the deprecated `customization_id`
@@ -811,13 +886,13 @@ module IBMWatson
811
886
  # match the model specified with the `model` parameter. You must make the request
812
887
  # with credentials for the instance of the service that owns the custom model. By
813
888
  # default, no custom acoustic model is used. See [Custom
814
- # models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
815
- # @param base_model_version [String] The version of the specified base model that is to be used with recognition
889
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#custom-input).
890
+ # @param base_model_version [String] The version of the specified base model that is to be used with the recognition
816
891
  # request. Multiple versions of a base model can exist when a model is updated for
817
892
  # internal improvements. The parameter is intended primarily for use with custom
818
893
  # models that have been upgraded for a new base model. The default value depends on
819
894
  # whether the parameter is used with or without a custom model. See [Base model
820
- # version](https://cloud.ibm.com/docs/services/speech-to-text/input.html#version).
895
+ # version](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#version).
821
896
  # @param customization_weight [Float] If you specify the customization ID (GUID) of a custom language model with the
822
897
  # recognition request, the customization weight tells the service how much weight to
823
898
  # give to words from the custom language model compared to those from the base model
@@ -835,45 +910,45 @@ module IBMWatson
835
910
  # phrases.
836
911
  #
837
912
  # See [Custom
838
- # models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom-input).
913
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#custom-input).
839
914
  # @param inactivity_timeout [Fixnum] The time in seconds after which, if only silence (no speech) is detected in
840
915
  # streaming audio, the connection is closed with a 400 error. The parameter is
841
916
  # useful for stopping audio submission from a live microphone when a user simply
842
917
  # walks away. Use `-1` for infinity. See [Inactivity
843
- # timeout](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts-inactivity).
918
+ # timeout](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#timeouts-inactivity).
844
919
  # @param keywords [Array[String]] An array of keyword strings to spot in the audio. Each keyword string can include
845
920
  # one or more string tokens. Keywords are spotted only in the final results, not in
846
921
  # interim hypotheses. If you specify any keywords, you must also specify a keywords
847
922
  # threshold. You can spot a maximum of 1000 keywords. Omit the parameter or specify
848
923
  # an empty array if you do not need to spot keywords. See [Keyword
849
- # spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
924
+ # spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#keyword_spotting).
850
925
  # @param keywords_threshold [Float] A confidence value that is the lower bound for spotting a keyword. A word is
851
926
  # considered to match a keyword if its confidence is greater than or equal to the
852
927
  # threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold,
853
928
  # you must also specify one or more keywords. The service performs no keyword
854
929
  # spotting if you omit either parameter. See [Keyword
855
- # spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
930
+ # spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#keyword_spotting).
856
931
  # @param max_alternatives [Fixnum] The maximum number of alternative transcripts that the service is to return. By
857
932
  # default, the service returns a single transcript. If you specify a value of `0`,
858
933
  # the service uses the default value, `1`. See [Maximum
859
- # alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#max_alternatives).
934
+ # alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#max_alternatives).
860
935
  # @param word_alternatives_threshold [Float] A confidence value that is the lower bound for identifying a hypothesis as a
861
936
  # possible word alternative (also known as \"Confusion Networks\"). An alternative
862
937
  # word is considered if its confidence is greater than or equal to the threshold.
863
938
  # Specify a probability between 0.0 and 1.0. By default, the service computes no
864
939
  # alternative words. See [Word
865
- # alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_alternatives).
940
+ # alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#word_alternatives).
866
941
  # @param word_confidence [Boolean] If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for
867
942
  # each word. By default, the service returns no word confidence scores. See [Word
868
- # confidence](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_confidence).
943
+ # confidence](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#word_confidence).
869
944
  # @param timestamps [Boolean] If `true`, the service returns time alignment for each word. By default, no
870
945
  # timestamps are returned. See [Word
871
- # timestamps](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_timestamps).
946
+ # timestamps](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#word_timestamps).
872
947
  # @param profanity_filter [Boolean] If `true`, the service filters profanity from all output except for keyword
873
948
  # results by replacing inappropriate words with a series of asterisks. Set the
874
949
  # parameter to `false` to return results with no censoring. Applies to US English
875
950
  # transcription only. See [Profanity
876
- # filtering](https://cloud.ibm.com/docs/services/speech-to-text/output.html#profanity_filter).
951
+ # filtering](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#profanity_filter).
877
952
  # @param smart_formatting [Boolean] If `true`, the service converts dates, times, series of digits and numbers, phone
878
953
  # numbers, currency values, and internet addresses into more readable, conventional
879
954
  # representations in the final transcript of a recognition request. For US English,
@@ -883,7 +958,7 @@ module IBMWatson
883
958
  # **Note:** Applies to US English, Japanese, and Spanish transcription only.
884
959
  #
885
960
  # See [Smart
886
- # formatting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#smart_formatting).
961
+ # formatting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#smart_formatting).
887
962
  # @param speaker_labels [Boolean] If `true`, the response includes labels that identify which words were spoken by
888
963
  # which participants in a multi-person exchange. By default, the service returns no
889
964
  # speaker labels. Setting `speaker_labels` to `true` forces the `timestamps`
@@ -896,7 +971,7 @@ module IBMWatson
896
971
  # `true`.
897
972
  #
898
973
  # See [Speaker
899
- # labels](https://cloud.ibm.com/docs/services/speech-to-text/output.html#speaker_labels).
974
+ # labels](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#speaker_labels).
900
975
  # @param customization_id [String] **Deprecated.** Use the `language_customization_id` parameter to specify the
901
976
  # customization ID (GUID) of a custom language model that is to be used with the
902
977
  # recognition request. Do not specify both parameters with a request.
@@ -905,7 +980,7 @@ module IBMWatson
905
980
  # specify the name of the custom language model for which the grammar is defined.
906
981
  # The service recognizes only strings that are recognized by the specified grammar;
907
982
  # it does not recognize other custom words from the model's words resource. See
908
- # [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/input.html#grammars-input).
983
+ # [Grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-input#grammars-input).
909
984
  # @param redaction [Boolean] If `true`, the service redacts, or masks, numeric data from final transcripts. The
910
985
  # feature redacts any number that has three or more consecutive digits by replacing
911
986
  # each digit with an `X` character. It is intended to redact sensitive numeric data,
@@ -920,11 +995,29 @@ module IBMWatson
920
995
  # **Note:** Applies to US English, Japanese, and Korean transcription only.
921
996
  #
922
997
  # See [Numeric
923
- # redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
998
+ # redaction](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#redaction).
999
+ #
1000
+ # @param processing_metrics [Boolean] If `true`, requests processing metrics about the service's transcription of the
1001
+ # input audio. The service returns processing metrics at the interval specified by
1002
+ # the `processing_metrics_interval` parameter. It also returns processing metrics
1003
+ # for transcription events, for example, for final and interim results. By default,
1004
+ # the service returns no processing metrics.
1005
+ # @param processing_metrics_interval [Float] Specifies the interval in real wall-clock seconds at which the service is to
1006
+ # return processing metrics. The parameter is ignored unless the
1007
+ # `processing_metrics` parameter is set to `true`. # The parameter accepts a minimum value of 0.1 seconds. The level of precision is
1008
+ # not restricted, so you can specify values such as 0.25 and 0.125.
1009
+ #
1010
+ # The service does not impose a maximum value. If you want to receive processing
1011
+ # metrics only for transcription events instead of at periodic intervals, set the
1012
+ # value to a large number. If the value is larger than the duration of the audio,
1013
+ # the service returns processing metrics only for transcription events.
1014
+ # @param audio_metrics [Boolean] If `true`, requests detailed information about the signal characteristics of the
1015
+ # input audio. The service returns audio metrics with the final transcription
1016
+ # results. By default, the service returns no audio metrics.
924
1017
  # @param content_type [String] The format (MIME type) of the audio. For more information about specifying an
925
1018
  # audio format, see **Audio formats (content types)** in the method description.
926
1019
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
927
- def create_job(audio:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, content_type: nil)
1020
+ def create_job(audio:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, processing_metrics: nil, processing_metrics_interval: nil, audio_metrics: nil, content_type: nil)
928
1021
  raise ArgumentError.new("audio must be provided") if audio.nil?
929
1022
 
930
1023
  headers = {
@@ -955,7 +1048,10 @@ module IBMWatson
955
1048
  "speaker_labels" => speaker_labels,
956
1049
  "customization_id" => customization_id,
957
1050
  "grammar_name" => grammar_name,
958
- "redaction" => redaction
1051
+ "redaction" => redaction,
1052
+ "processing_metrics" => processing_metrics,
1053
+ "processing_metrics_interval" => processing_metrics_interval,
1054
+ "audio_metrics" => audio_metrics
959
1055
  }
960
1056
 
961
1057
  data = audio
@@ -973,6 +1069,78 @@ module IBMWatson
973
1069
  response
974
1070
  end
975
1071
 
1072
+ ##
1073
+ # @!method check_jobs
1074
+ # Check jobs.
1075
+ # Returns the ID and status of the latest 100 outstanding jobs associated with the
1076
+ # credentials with which it is called. The method also returns the creation and
1077
+ # update times of each job, and, if a job was created with a callback URL and a user
1078
+ # token, the user token for the job. To obtain the results for a job whose status is
1079
+ # `completed` or not one of the latest 100 outstanding jobs, use the **Check a job**
1080
+ # method. A job and its results remain available until you delete them with the
1081
+ # **Delete a job** method or until the job's time to live expires, whichever comes
1082
+ # first.
1083
+ #
1084
+ # **See also:** [Checking the status of the latest
1085
+ # jobs](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-async#jobs).
1086
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1087
+ def check_jobs
1088
+ headers = {
1089
+ }
1090
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "check_jobs")
1091
+ headers.merge!(sdk_headers)
1092
+
1093
+ method_url = "/v1/recognitions"
1094
+
1095
+ response = request(
1096
+ method: "GET",
1097
+ url: method_url,
1098
+ headers: headers,
1099
+ accept_json: true
1100
+ )
1101
+ response
1102
+ end
1103
+
1104
+ ##
1105
+ # @!method check_job(id:)
1106
+ # Check a job.
1107
+ # Returns information about the specified job. The response always includes the
1108
+ # status of the job and its creation and update times. If the status is `completed`,
1109
+ # the response includes the results of the recognition request. You must use
1110
+ # credentials for the instance of the service that owns a job to list information
1111
+ # about it.
1112
+ #
1113
+ # You can use the method to retrieve the results of any job, regardless of whether
1114
+ # it was submitted with a callback URL and the `recognitions.completed_with_results`
1115
+ # event, and you can retrieve the results multiple times for as long as they remain
1116
+ # available. Use the **Check jobs** method to request information about the most
1117
+ # recent jobs associated with the calling credentials.
1118
+ #
1119
+ # **See also:** [Checking the status and retrieving the results of a
1120
+ # job](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-async#job).
1121
+ # @param id [String] The identifier of the asynchronous job that is to be used for the request. You
1122
+ # must make the request with credentials for the instance of the service that owns
1123
+ # the job.
1124
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1125
+ def check_job(id:)
1126
+ raise ArgumentError.new("id must be provided") if id.nil?
1127
+
1128
+ headers = {
1129
+ }
1130
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "check_job")
1131
+ headers.merge!(sdk_headers)
1132
+
1133
+ method_url = "/v1/recognitions/%s" % [ERB::Util.url_encode(id)]
1134
+
1135
+ response = request(
1136
+ method: "GET",
1137
+ url: method_url,
1138
+ headers: headers,
1139
+ accept_json: true
1140
+ )
1141
+ response
1142
+ end
1143
+
976
1144
  ##
977
1145
  # @!method delete_job(id:)
978
1146
  # Delete a job.
@@ -983,7 +1151,7 @@ module IBMWatson
983
1151
  # owns a job to delete it.
984
1152
  #
985
1153
  # **See also:** [Deleting a
986
- # job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#delete-async).
1154
+ # job](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-async#delete-async).
987
1155
  # @param id [String] The identifier of the asynchronous job that is to be used for the request. You
988
1156
  # must make the request with credentials for the instance of the service that owns
989
1157
  # the job.
@@ -1006,128 +1174,20 @@ module IBMWatson
1006
1174
  )
1007
1175
  nil
1008
1176
  end
1177
+ #########################
1178
+ # Custom language models
1179
+ #########################
1009
1180
 
1010
1181
  ##
1011
- # @!method register_callback(callback_url:, user_secret: nil)
1012
- # Register a callback.
1013
- # Registers a callback URL with the service for use with subsequent asynchronous
1014
- # recognition requests. The service attempts to register, or white-list, the
1015
- # callback URL if it is not already registered by sending a `GET` request to the
1016
- # callback URL. The service passes a random alphanumeric challenge string via the
1017
- # `challenge_string` parameter of the request. The request includes an `Accept`
1018
- # header that specifies `text/plain` as the required response type.
1019
- #
1020
- # To be registered successfully, the callback URL must respond to the `GET` request
1021
- # from the service. The response must send status code 200 and must include the
1022
- # challenge string in its body. Set the `Content-Type` response header to
1023
- # `text/plain`. Upon receiving this response, the service responds to the original
1024
- # registration request with response code 201.
1025
- #
1026
- # The service sends only a single `GET` request to the callback URL. If the service
1027
- # does not receive a reply with a response code of 200 and a body that echoes the
1028
- # challenge string sent by the service within five seconds, it does not white-list
1029
- # the URL; it instead sends status code 400 in response to the **Register a
1030
- # callback** request. If the requested callback URL is already white-listed, the
1031
- # service responds to the initial registration request with response code 200.
1032
- #
1033
- # If you specify a user secret with the request, the service uses it as a key to
1034
- # calculate an HMAC-SHA1 signature of the challenge string in its response to the
1035
- # `POST` request. It sends this signature in the `X-Callback-Signature` header of
1036
- # its `GET` request to the URL during registration. It also uses the secret to
1037
- # calculate a signature over the payload of every callback notification that uses
1038
- # the URL. The signature provides authentication and data integrity for HTTP
1039
- # communications.
1040
- #
1041
- # After you successfully register a callback URL, you can use it with an indefinite
1042
- # number of recognition requests. You can register a maximum of 20 callback URLS in
1043
- # a one-hour span of time.
1044
- #
1045
- # **See also:** [Registering a callback
1046
- # URL](https://cloud.ibm.com/docs/services/speech-to-text/async.html#register).
1047
- # @param callback_url [String] An HTTP or HTTPS URL to which callback notifications are to be sent. To be
1048
- # white-listed, the URL must successfully echo the challenge string during URL
1049
- # verification. During verification, the client can also check the signature that
1050
- # the service sends in the `X-Callback-Signature` header to verify the origin of the
1051
- # request.
1052
- # @param user_secret [String] A user-specified string that the service uses to generate the HMAC-SHA1 signature
1053
- # that it sends via the `X-Callback-Signature` header. The service includes the
1054
- # header during URL verification and with every notification sent to the callback
1055
- # URL. It calculates the signature over the payload of the notification. If you omit
1056
- # the parameter, the service does not send the header.
1057
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1058
- def register_callback(callback_url:, user_secret: nil)
1059
- raise ArgumentError.new("callback_url must be provided") if callback_url.nil?
1060
-
1061
- headers = {
1062
- }
1063
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "register_callback")
1064
- headers.merge!(sdk_headers)
1065
-
1066
- params = {
1067
- "callback_url" => callback_url,
1068
- "user_secret" => user_secret
1069
- }
1070
-
1071
- method_url = "/v1/register_callback"
1072
-
1073
- response = request(
1074
- method: "POST",
1075
- url: method_url,
1076
- headers: headers,
1077
- params: params,
1078
- accept_json: true
1079
- )
1080
- response
1081
- end
1082
-
1083
- ##
1084
- # @!method unregister_callback(callback_url:)
1085
- # Unregister a callback.
1086
- # Unregisters a callback URL that was previously white-listed with a **Register a
1087
- # callback** request for use with the asynchronous interface. Once unregistered, the
1088
- # URL can no longer be used with asynchronous recognition requests.
1089
- #
1090
- # **See also:** [Unregistering a callback
1091
- # URL](https://cloud.ibm.com/docs/services/speech-to-text/async.html#unregister).
1092
- # @param callback_url [String] The callback URL that is to be unregistered.
1093
- # @return [nil]
1094
- def unregister_callback(callback_url:)
1095
- raise ArgumentError.new("callback_url must be provided") if callback_url.nil?
1096
-
1097
- headers = {
1098
- }
1099
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "unregister_callback")
1100
- headers.merge!(sdk_headers)
1101
-
1102
- params = {
1103
- "callback_url" => callback_url
1104
- }
1105
-
1106
- method_url = "/v1/unregister_callback"
1107
-
1108
- request(
1109
- method: "POST",
1110
- url: method_url,
1111
- headers: headers,
1112
- params: params,
1113
- accept_json: false
1114
- )
1115
- nil
1116
- end
1117
- #########################
1118
- # Custom language models
1119
- #########################
1120
-
1121
- ##
1122
- # @!method create_language_model(name:, base_model_name:, dialect: nil, description: nil)
1123
- # Create a custom language model.
1124
- # Creates a new custom language model for a specified base model. The custom
1125
- # language model can be used only with the base model for which it is created. The
1126
- # model is owned by the instance of the service whose credentials are used to create
1127
- # it.
1182
+ # @!method create_language_model(name:, base_model_name:, dialect: nil, description: nil)
1183
+ # Create a custom language model.
1184
+ # Creates a new custom language model for a specified base model. The custom
1185
+ # language model can be used only with the base model for which it is created. The
1186
+ # model is owned by the instance of the service whose credentials are used to create
1187
+ # it.
1128
1188
  #
1129
1189
  # **See also:** [Create a custom language
1130
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#createModel-language).
1190
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#createModel-language).
1131
1191
  # @param name [String] A user-defined name for the new custom language model. Use a name that is unique
1132
1192
  # among all custom language models that you own. Use a localized name that matches
1133
1193
  # the language of the custom model. Use a name that describes the domain of the
@@ -1139,7 +1199,7 @@ module IBMWatson
1139
1199
  # To determine whether a base model supports language model customization, use the
1140
1200
  # **Get a model** method and check that the attribute `custom_language_model` is set
1141
1201
  # to `true`. You can also refer to [Language support for
1142
- # customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
1202
+ # customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport).
1143
1203
  # @param dialect [String] The dialect of the specified language that is to be used with the custom language
1144
1204
  # model. The parameter is meaningful only for Spanish models, for which the service
1145
1205
  # creates a custom language model that is suited for speech in one of the following
@@ -1184,36 +1244,40 @@ module IBMWatson
1184
1244
  end
1185
1245
 
1186
1246
  ##
1187
- # @!method delete_language_model(customization_id:)
1188
- # Delete a custom language model.
1189
- # Deletes an existing custom language model. The custom model cannot be deleted if
1190
- # another request, such as adding a corpus or grammar to the model, is currently
1191
- # being processed. You must use credentials for the instance of the service that
1192
- # owns a model to delete it.
1247
+ # @!method list_language_models(language: nil)
1248
+ # List custom language models.
1249
+ # Lists information about all custom language models that are owned by an instance
1250
+ # of the service. Use the `language` parameter to see all custom language models for
1251
+ # the specified language. Omit the parameter to see all custom language models for
1252
+ # all languages. You must use credentials for the instance of the service that owns
1253
+ # a model to list information about it.
1193
1254
  #
1194
- # **See also:** [Deleting a custom language
1195
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#deleteModel-language).
1196
- # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1197
- # the request. You must make the request with credentials for the instance of the
1198
- # service that owns the custom model.
1199
- # @return [nil]
1200
- def delete_language_model(customization_id:)
1201
- raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1202
-
1255
+ # **See also:** [Listing custom language
1256
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language).
1257
+ # @param language [String] The identifier of the language for which custom language or custom acoustic models
1258
+ # are to be returned (for example, `en-US`). Omit the parameter to see all custom
1259
+ # language or custom acoustic models that are owned by the requesting credentials.
1260
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1261
+ def list_language_models(language: nil)
1203
1262
  headers = {
1204
1263
  }
1205
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_language_model")
1264
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_language_models")
1206
1265
  headers.merge!(sdk_headers)
1207
1266
 
1208
- method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
1267
+ params = {
1268
+ "language" => language
1269
+ }
1209
1270
 
1210
- request(
1211
- method: "DELETE",
1271
+ method_url = "/v1/customizations"
1272
+
1273
+ response = request(
1274
+ method: "GET",
1212
1275
  url: method_url,
1213
1276
  headers: headers,
1277
+ params: params,
1214
1278
  accept_json: true
1215
1279
  )
1216
- nil
1280
+ response
1217
1281
  end
1218
1282
 
1219
1283
  ##
@@ -1223,7 +1287,7 @@ module IBMWatson
1223
1287
  # for the instance of the service that owns a model to list information about it.
1224
1288
  #
1225
1289
  # **See also:** [Listing custom language
1226
- # models](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#listModels-language).
1290
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language).
1227
1291
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1228
1292
  # the request. You must make the request with credentials for the instance of the
1229
1293
  # service that owns the custom model.
@@ -1248,70 +1312,31 @@ module IBMWatson
1248
1312
  end
1249
1313
 
1250
1314
  ##
1251
- # @!method list_language_models(language: nil)
1252
- # List custom language models.
1253
- # Lists information about all custom language models that are owned by an instance
1254
- # of the service. Use the `language` parameter to see all custom language models for
1255
- # the specified language. Omit the parameter to see all custom language models for
1256
- # all languages. You must use credentials for the instance of the service that owns
1257
- # a model to list information about it.
1258
- #
1259
- # **See also:** [Listing custom language
1260
- # models](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#listModels-language).
1261
- # @param language [String] The identifier of the language for which custom language or custom acoustic models
1262
- # are to be returned (for example, `en-US`). Omit the parameter to see all custom
1263
- # language or custom acoustic models that are owned by the requesting credentials.
1264
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1265
- def list_language_models(language: nil)
1266
- headers = {
1267
- }
1268
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_language_models")
1269
- headers.merge!(sdk_headers)
1270
-
1271
- params = {
1272
- "language" => language
1273
- }
1274
-
1275
- method_url = "/v1/customizations"
1276
-
1277
- response = request(
1278
- method: "GET",
1279
- url: method_url,
1280
- headers: headers,
1281
- params: params,
1282
- accept_json: true
1283
- )
1284
- response
1285
- end
1286
-
1287
- ##
1288
- # @!method reset_language_model(customization_id:)
1289
- # Reset a custom language model.
1290
- # Resets a custom language model by removing all corpora, grammars, and words from
1291
- # the model. Resetting a custom language model initializes the model to its state
1292
- # when it was first created. Metadata such as the name and language of the model are
1293
- # preserved, but the model's words resource is removed and must be re-created. You
1294
- # must use credentials for the instance of the service that owns a model to reset
1295
- # it.
1315
+ # @!method delete_language_model(customization_id:)
1316
+ # Delete a custom language model.
1317
+ # Deletes an existing custom language model. The custom model cannot be deleted if
1318
+ # another request, such as adding a corpus or grammar to the model, is currently
1319
+ # being processed. You must use credentials for the instance of the service that
1320
+ # owns a model to delete it.
1296
1321
  #
1297
- # **See also:** [Resetting a custom language
1298
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#resetModel-language).
1322
+ # **See also:** [Deleting a custom language
1323
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#deleteModel-language).
1299
1324
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1300
1325
  # the request. You must make the request with credentials for the instance of the
1301
1326
  # service that owns the custom model.
1302
1327
  # @return [nil]
1303
- def reset_language_model(customization_id:)
1328
+ def delete_language_model(customization_id:)
1304
1329
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1305
1330
 
1306
1331
  headers = {
1307
1332
  }
1308
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "reset_language_model")
1333
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_language_model")
1309
1334
  headers.merge!(sdk_headers)
1310
1335
 
1311
- method_url = "/v1/customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
1336
+ method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
1312
1337
 
1313
1338
  request(
1314
- method: "POST",
1339
+ method: "DELETE",
1315
1340
  url: method_url,
1316
1341
  headers: headers,
1317
1342
  accept_json: true
@@ -1342,15 +1367,16 @@ module IBMWatson
1342
1367
  # and ready to use. The service cannot accept subsequent training requests or
1343
1368
  # requests to add new resources until the existing request completes.
1344
1369
  #
1345
- # Training can fail to start for the following reasons:
1370
+ # **See also:** [Train the custom language
1371
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#trainModel-language).
1372
+ #
1373
+ #
1374
+ # ### Training failures
1375
+ #
1376
+ # Training can fail to start for the following reasons:
1346
1377
  # * The service is currently handling another request for the custom model, such as
1347
1378
  # another training request or a request to add a corpus or grammar to the model.
1348
1379
  # * No training data have been added to the custom model.
1349
- # * One or more words that were added to the custom model have invalid sounds-like
1350
- # pronunciations that you must fix.
1351
- #
1352
- # **See also:** [Train the custom language
1353
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#trainModel-language).
1354
1380
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1355
1381
  # the request. You must make the request with credentials for the instance of the
1356
1382
  # service that owns the custom model.
@@ -1376,7 +1402,7 @@ module IBMWatson
1376
1402
  # The value that you assign is used for all recognition requests that use the model.
1377
1403
  # You can override it for any recognition request by specifying a customization
1378
1404
  # weight for that request.
1379
- # @return [nil]
1405
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1380
1406
  def train_language_model(customization_id:, word_type_to_add: nil, customization_weight: nil)
1381
1407
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1382
1408
 
@@ -1392,13 +1418,48 @@ module IBMWatson
1392
1418
 
1393
1419
  method_url = "/v1/customizations/%s/train" % [ERB::Util.url_encode(customization_id)]
1394
1420
 
1395
- request(
1421
+ response = request(
1396
1422
  method: "POST",
1397
1423
  url: method_url,
1398
1424
  headers: headers,
1399
1425
  params: params,
1400
1426
  accept_json: true
1401
1427
  )
1428
+ response
1429
+ end
1430
+
1431
+ ##
1432
+ # @!method reset_language_model(customization_id:)
1433
+ # Reset a custom language model.
1434
+ # Resets a custom language model by removing all corpora, grammars, and words from
1435
+ # the model. Resetting a custom language model initializes the model to its state
1436
+ # when it was first created. Metadata such as the name and language of the model are
1437
+ # preserved, but the model's words resource is removed and must be re-created. You
1438
+ # must use credentials for the instance of the service that owns a model to reset
1439
+ # it.
1440
+ #
1441
+ # **See also:** [Resetting a custom language
1442
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageLanguageModels#resetModel-language).
1443
+ # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1444
+ # the request. You must make the request with credentials for the instance of the
1445
+ # service that owns the custom model.
1446
+ # @return [nil]
1447
+ def reset_language_model(customization_id:)
1448
+ raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1449
+
1450
+ headers = {
1451
+ }
1452
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "reset_language_model")
1453
+ headers.merge!(sdk_headers)
1454
+
1455
+ method_url = "/v1/customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
1456
+
1457
+ request(
1458
+ method: "POST",
1459
+ url: method_url,
1460
+ headers: headers,
1461
+ accept_json: true
1462
+ )
1402
1463
  nil
1403
1464
  end
1404
1465
 
@@ -1422,7 +1483,7 @@ module IBMWatson
1422
1483
  # subsequent requests for the model until the upgrade completes.
1423
1484
  #
1424
1485
  # **See also:** [Upgrading a custom language
1425
- # model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeLanguage).
1486
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customUpgrade#upgradeLanguage).
1426
1487
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1427
1488
  # the request. You must make the request with credentials for the instance of the
1428
1489
  # service that owns the custom model.
@@ -1449,6 +1510,39 @@ module IBMWatson
1449
1510
  # Custom corpora
1450
1511
  #########################
1451
1512
 
1513
+ ##
1514
+ # @!method list_corpora(customization_id:)
1515
+ # List corpora.
1516
+ # Lists information about all corpora from a custom language model. The information
1517
+ # includes the total number of words and out-of-vocabulary (OOV) words, name, and
1518
+ # status of each corpus. You must use credentials for the instance of the service
1519
+ # that owns a model to list its corpora.
1520
+ #
1521
+ # **See also:** [Listing corpora for a custom language
1522
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageCorpora#listCorpora).
1523
+ # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1524
+ # the request. You must make the request with credentials for the instance of the
1525
+ # service that owns the custom model.
1526
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1527
+ def list_corpora(customization_id:)
1528
+ raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1529
+
1530
+ headers = {
1531
+ }
1532
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_corpora")
1533
+ headers.merge!(sdk_headers)
1534
+
1535
+ method_url = "/v1/customizations/%s/corpora" % [ERB::Util.url_encode(customization_id)]
1536
+
1537
+ response = request(
1538
+ method: "GET",
1539
+ url: method_url,
1540
+ headers: headers,
1541
+ accept_json: true
1542
+ )
1543
+ response
1544
+ end
1545
+
1452
1546
  ##
1453
1547
  # @!method add_corpus(customization_id:, corpus_name:, corpus_file:, allow_overwrite: nil)
1454
1548
  # Add a corpus.
@@ -1488,15 +1582,15 @@ module IBMWatson
1488
1582
  #
1489
1583
  # The service limits the overall amount of data that you can add to a custom model
1490
1584
  # to a maximum of 10 million total words from all sources combined. Also, you can
1491
- # add no more than 30 thousand custom (OOV) words to a model. This includes words
1585
+ # add no more than 90 thousand custom (OOV) words to a model. This includes words
1492
1586
  # that the service extracts from corpora and grammars, and words that you add
1493
1587
  # directly.
1494
1588
  #
1495
1589
  # **See also:**
1496
1590
  # * [Working with
1497
- # corpora](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingCorpora)
1498
- # * [Add corpora to the custom language
1499
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addCorpora).
1591
+ # corpora](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#workingCorpora)
1592
+ # * [Add a corpus to the custom language
1593
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#addCorpus).
1500
1594
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1501
1595
  # the request. You must make the request with credentials for the instance of the
1502
1596
  # service that owns the custom model.
@@ -1516,7 +1610,7 @@ module IBMWatson
1516
1610
  # Make sure that you know the character encoding of the file. You must use that
1517
1611
  # encoding when working with the words in the custom language model. For more
1518
1612
  # information, see [Character
1519
- # encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
1613
+ # encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#charEncoding).
1520
1614
  #
1521
1615
  #
1522
1616
  # With the `curl` command, use the `--data-binary` option to upload the file for the
@@ -1561,6 +1655,42 @@ module IBMWatson
1561
1655
  nil
1562
1656
  end
1563
1657
 
1658
+ ##
1659
+ # @!method get_corpus(customization_id:, corpus_name:)
1660
+ # Get a corpus.
1661
+ # Gets information about a corpus from a custom language model. The information
1662
+ # includes the total number of words and out-of-vocabulary (OOV) words, name, and
1663
+ # status of the corpus. You must use credentials for the instance of the service
1664
+ # that owns a model to list its corpora.
1665
+ #
1666
+ # **See also:** [Listing corpora for a custom language
1667
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageCorpora#listCorpora).
1668
+ # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1669
+ # the request. You must make the request with credentials for the instance of the
1670
+ # service that owns the custom model.
1671
+ # @param corpus_name [String] The name of the corpus for the custom language model.
1672
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1673
+ def get_corpus(customization_id:, corpus_name:)
1674
+ raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1675
+
1676
+ raise ArgumentError.new("corpus_name must be provided") if corpus_name.nil?
1677
+
1678
+ headers = {
1679
+ }
1680
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "get_corpus")
1681
+ headers.merge!(sdk_headers)
1682
+
1683
+ method_url = "/v1/customizations/%s/corpora/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(corpus_name)]
1684
+
1685
+ response = request(
1686
+ method: "GET",
1687
+ url: method_url,
1688
+ headers: headers,
1689
+ accept_json: true
1690
+ )
1691
+ response
1692
+ end
1693
+
1564
1694
  ##
1565
1695
  # @!method delete_corpus(customization_id:, corpus_name:)
1566
1696
  # Delete a corpus.
@@ -1574,7 +1704,7 @@ module IBMWatson
1574
1704
  # corpora.
1575
1705
  #
1576
1706
  # **See also:** [Deleting a corpus from a custom language
1577
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#deleteCorpus).
1707
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageCorpora#deleteCorpus).
1578
1708
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1579
1709
  # the request. You must make the request with credentials for the instance of the
1580
1710
  # service that owns the custom model.
@@ -1600,78 +1730,154 @@ module IBMWatson
1600
1730
  )
1601
1731
  nil
1602
1732
  end
1733
+ #########################
1734
+ # Custom words
1735
+ #########################
1603
1736
 
1604
1737
  ##
1605
- # @!method get_corpus(customization_id:, corpus_name:)
1606
- # Get a corpus.
1607
- # Gets information about a corpus from a custom language model. The information
1608
- # includes the total number of words and out-of-vocabulary (OOV) words, name, and
1609
- # status of the corpus. You must use credentials for the instance of the service
1610
- # that owns a model to list its corpora.
1738
+ # @!method list_words(customization_id:, word_type: nil, sort: nil)
1739
+ # List custom words.
1740
+ # Lists information about custom words from a custom language model. You can list
1741
+ # all words from the custom model's words resource, only custom words that were
1742
+ # added or modified by the user, or only out-of-vocabulary (OOV) words that were
1743
+ # extracted from corpora or are recognized by grammars. You can also indicate the
1744
+ # order in which the service is to return words; by default, the service lists words
1745
+ # in ascending alphabetical order. You must use credentials for the instance of the
1746
+ # service that owns a model to list information about its words.
1611
1747
  #
1612
- # **See also:** [Listing corpora for a custom language
1613
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#listCorpora).
1748
+ # **See also:** [Listing words from a custom language
1749
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageWords#listWords).
1614
1750
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1615
1751
  # the request. You must make the request with credentials for the instance of the
1616
1752
  # service that owns the custom model.
1617
- # @param corpus_name [String] The name of the corpus for the custom language model.
1753
+ # @param word_type [String] The type of words to be listed from the custom language model's words resource:
1754
+ # * `all` (the default) shows all words.
1755
+ # * `user` shows only custom words that were added or modified by the user directly.
1756
+ # * `corpora` shows only OOV that were extracted from corpora.
1757
+ # * `grammars` shows only OOV words that are recognized by grammars.
1758
+ # @param sort [String] Indicates the order in which the words are to be listed, `alphabetical` or by
1759
+ # `count`. You can prepend an optional `+` or `-` to an argument to indicate whether
1760
+ # the results are to be sorted in ascending or descending order. By default, words
1761
+ # are sorted in ascending alphabetical order. For alphabetical ordering, the
1762
+ # lexicographical precedence is numeric values, uppercase letters, and lowercase
1763
+ # letters. For count ordering, values with the same count are ordered
1764
+ # alphabetically. With the `curl` command, URL encode the `+` symbol as `%2B`.
1618
1765
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1619
- def get_corpus(customization_id:, corpus_name:)
1766
+ def list_words(customization_id:, word_type: nil, sort: nil)
1620
1767
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1621
1768
 
1622
- raise ArgumentError.new("corpus_name must be provided") if corpus_name.nil?
1623
-
1624
1769
  headers = {
1625
1770
  }
1626
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "get_corpus")
1771
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_words")
1627
1772
  headers.merge!(sdk_headers)
1628
1773
 
1629
- method_url = "/v1/customizations/%s/corpora/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(corpus_name)]
1774
+ params = {
1775
+ "word_type" => word_type,
1776
+ "sort" => sort
1777
+ }
1778
+
1779
+ method_url = "/v1/customizations/%s/words" % [ERB::Util.url_encode(customization_id)]
1630
1780
 
1631
1781
  response = request(
1632
1782
  method: "GET",
1633
1783
  url: method_url,
1634
1784
  headers: headers,
1785
+ params: params,
1635
1786
  accept_json: true
1636
1787
  )
1637
1788
  response
1638
1789
  end
1639
1790
 
1640
1791
  ##
1641
- # @!method list_corpora(customization_id:)
1642
- # List corpora.
1643
- # Lists information about all corpora from a custom language model. The information
1644
- # includes the total number of words and out-of-vocabulary (OOV) words, name, and
1645
- # status of each corpus. You must use credentials for the instance of the service
1646
- # that owns a model to list its corpora.
1792
+ # @!method add_words(customization_id:, words:)
1793
+ # Add custom words.
1794
+ # Adds one or more custom words to a custom language model. The service populates
1795
+ # the words resource for a custom model with out-of-vocabulary (OOV) words from each
1796
+ # corpus or grammar that is added to the model. You can use this method to add
1797
+ # additional words or to modify existing words in the words resource. The words
1798
+ # resource for a model can contain a maximum of 90 thousand custom (OOV) words. This
1799
+ # includes words that the service extracts from corpora and grammars and words that
1800
+ # you add directly.
1647
1801
  #
1648
- # **See also:** [Listing corpora for a custom language
1649
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#listCorpora).
1802
+ # You must use credentials for the instance of the service that owns a model to add
1803
+ # or modify custom words for the model. Adding or modifying custom words does not
1804
+ # affect the custom model until you train the model for the new data by using the
1805
+ # **Train a custom language model** method.
1806
+ #
1807
+ # You add custom words by providing a `CustomWords` object, which is an array of
1808
+ # `CustomWord` objects, one per word. You must use the object's `word` parameter to
1809
+ # identify the word that is to be added. You can also provide one or both of the
1810
+ # optional `sounds_like` and `display_as` fields for each word.
1811
+ # * The `sounds_like` field provides an array of one or more pronunciations for the
1812
+ # word. Use the parameter to specify how the word can be pronounced by users. Use
1813
+ # the parameter for words that are difficult to pronounce, foreign words, acronyms,
1814
+ # and so on. For example, you might specify that the word `IEEE` can sound like `i
1815
+ # triple e`. You can specify a maximum of five sounds-like pronunciations for a
1816
+ # word.
1817
+ # * The `display_as` field provides a different way of spelling the word in a
1818
+ # transcript. Use the parameter when you want the word to appear different from its
1819
+ # usual representation or from its spelling in training data. For example, you might
1820
+ # indicate that the word `IBM(trademark)` is to be displayed as `IBM™`.
1821
+ #
1822
+ # If you add a custom word that already exists in the words resource for the custom
1823
+ # model, the new definition overwrites the existing data for the word. If the
1824
+ # service encounters an error with the input data, it returns a failure code and
1825
+ # does not add any of the words to the words resource.
1826
+ #
1827
+ # The call returns an HTTP 201 response code if the input data is valid. It then
1828
+ # asynchronously processes the words to add them to the model's words resource. The
1829
+ # time that it takes for the analysis to complete depends on the number of new words
1830
+ # that you add but is generally faster than adding a corpus or grammar.
1831
+ #
1832
+ # You can monitor the status of the request by using the **List a custom language
1833
+ # model** method to poll the model's status. Use a loop to check the status every 10
1834
+ # seconds. The method returns a `Customization` object that includes a `status`
1835
+ # field. A status of `ready` means that the words have been added to the custom
1836
+ # model. The service cannot accept requests to add new data or to train the model
1837
+ # until the existing request completes.
1838
+ #
1839
+ # You can use the **List custom words** or **List a custom word** method to review
1840
+ # the words that you add. Words with an invalid `sounds_like` field include an
1841
+ # `error` field that describes the problem. You can use other words-related methods
1842
+ # to correct errors, eliminate typos, and modify how words are pronounced as needed.
1843
+ #
1844
+ #
1845
+ # **See also:**
1846
+ # * [Working with custom
1847
+ # words](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#workingWords)
1848
+ # * [Add words to the custom language
1849
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#addWords).
1650
1850
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1651
1851
  # the request. You must make the request with credentials for the instance of the
1652
1852
  # service that owns the custom model.
1653
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1654
- def list_corpora(customization_id:)
1853
+ # @param words [Array[CustomWord]] An array of `CustomWord` objects that provides information about each custom word
1854
+ # that is to be added to or updated in the custom language model.
1855
+ # @return [nil]
1856
+ def add_words(customization_id:, words:)
1655
1857
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1656
1858
 
1859
+ raise ArgumentError.new("words must be provided") if words.nil?
1860
+
1657
1861
  headers = {
1658
1862
  }
1659
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_corpora")
1660
- headers.merge!(sdk_headers)
1863
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "add_words")
1864
+ headers.merge!(sdk_headers)
1865
+
1866
+ data = {
1867
+ "words" => words
1868
+ }
1661
1869
 
1662
- method_url = "/v1/customizations/%s/corpora" % [ERB::Util.url_encode(customization_id)]
1870
+ method_url = "/v1/customizations/%s/words" % [ERB::Util.url_encode(customization_id)]
1663
1871
 
1664
- response = request(
1665
- method: "GET",
1872
+ request(
1873
+ method: "POST",
1666
1874
  url: method_url,
1667
1875
  headers: headers,
1876
+ json: data,
1668
1877
  accept_json: true
1669
1878
  )
1670
- response
1879
+ nil
1671
1880
  end
1672
- #########################
1673
- # Custom words
1674
- #########################
1675
1881
 
1676
1882
  ##
1677
1883
  # @!method add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
@@ -1680,7 +1886,7 @@ module IBMWatson
1680
1886
  # resource for a custom model with out-of-vocabulary (OOV) words from each corpus or
1681
1887
  # grammar that is added to the model. You can use this method to add a word or to
1682
1888
  # modify an existing word in the words resource. The words resource for a model can
1683
- # contain a maximum of 30 thousand custom (OOV) words. This includes words that the
1889
+ # contain a maximum of 90 thousand custom (OOV) words. This includes words that the
1684
1890
  # service extracts from corpora and grammars and words that you add directly.
1685
1891
  #
1686
1892
  # You must use credentials for the instance of the service that owns a model to add
@@ -1709,9 +1915,9 @@ module IBMWatson
1709
1915
  #
1710
1916
  # **See also:**
1711
1917
  # * [Working with custom
1712
- # words](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingWords)
1918
+ # words](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#workingWords)
1713
1919
  # * [Add words to the custom language
1714
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addWords).
1920
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-languageCreate#addWords).
1715
1921
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1716
1922
  # the request. You must make the request with credentials for the instance of the
1717
1923
  # service that owns the custom model.
@@ -1719,7 +1925,7 @@ module IBMWatson
1719
1925
  # not include spaces in the word. Use a `-` (dash) or `_` (underscore) to connect
1720
1926
  # the tokens of compound words. URL-encode the word if it includes non-ASCII
1721
1927
  # characters. For more information, see [Character
1722
- # encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
1928
+ # encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#charEncoding).
1723
1929
  # @param word [String] For the **Add custom words** method, you must specify the custom word that is to
1724
1930
  # be added to or updated in the custom model. Do not include spaces in the word. Use
1725
1931
  # a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
@@ -1770,94 +1976,40 @@ module IBMWatson
1770
1976
  end
1771
1977
 
1772
1978
  ##
1773
- # @!method add_words(customization_id:, words:)
1774
- # Add custom words.
1775
- # Adds one or more custom words to a custom language model. The service populates
1776
- # the words resource for a custom model with out-of-vocabulary (OOV) words from each
1777
- # corpus or grammar that is added to the model. You can use this method to add
1778
- # additional words or to modify existing words in the words resource. The words
1779
- # resource for a model can contain a maximum of 30 thousand custom (OOV) words. This
1780
- # includes words that the service extracts from corpora and grammars and words that
1781
- # you add directly.
1782
- #
1783
- # You must use credentials for the instance of the service that owns a model to add
1784
- # or modify custom words for the model. Adding or modifying custom words does not
1785
- # affect the custom model until you train the model for the new data by using the
1786
- # **Train a custom language model** method.
1787
- #
1788
- # You add custom words by providing a `CustomWords` object, which is an array of
1789
- # `CustomWord` objects, one per word. You must use the object's `word` parameter to
1790
- # identify the word that is to be added. You can also provide one or both of the
1791
- # optional `sounds_like` and `display_as` fields for each word.
1792
- # * The `sounds_like` field provides an array of one or more pronunciations for the
1793
- # word. Use the parameter to specify how the word can be pronounced by users. Use
1794
- # the parameter for words that are difficult to pronounce, foreign words, acronyms,
1795
- # and so on. For example, you might specify that the word `IEEE` can sound like `i
1796
- # triple e`. You can specify a maximum of five sounds-like pronunciations for a
1797
- # word.
1798
- # * The `display_as` field provides a different way of spelling the word in a
1799
- # transcript. Use the parameter when you want the word to appear different from its
1800
- # usual representation or from its spelling in training data. For example, you might
1801
- # indicate that the word `IBM(trademark)` is to be displayed as `IBM™`.
1802
- #
1803
- # If you add a custom word that already exists in the words resource for the custom
1804
- # model, the new definition overwrites the existing data for the word. If the
1805
- # service encounters an error with the input data, it returns a failure code and
1806
- # does not add any of the words to the words resource.
1807
- #
1808
- # The call returns an HTTP 201 response code if the input data is valid. It then
1809
- # asynchronously processes the words to add them to the model's words resource. The
1810
- # time that it takes for the analysis to complete depends on the number of new words
1811
- # that you add but is generally faster than adding a corpus or grammar.
1812
- #
1813
- # You can monitor the status of the request by using the **List a custom language
1814
- # model** method to poll the model's status. Use a loop to check the status every 10
1815
- # seconds. The method returns a `Customization` object that includes a `status`
1816
- # field. A status of `ready` means that the words have been added to the custom
1817
- # model. The service cannot accept requests to add new data or to train the model
1818
- # until the existing request completes.
1819
- #
1820
- # You can use the **List custom words** or **List a custom word** method to review
1821
- # the words that you add. Words with an invalid `sounds_like` field include an
1822
- # `error` field that describes the problem. You can use other words-related methods
1823
- # to correct errors, eliminate typos, and modify how words are pronounced as needed.
1824
- #
1979
+ # @!method get_word(customization_id:, word_name:)
1980
+ # Get a custom word.
1981
+ # Gets information about a custom word from a custom language model. You must use
1982
+ # credentials for the instance of the service that owns a model to list information
1983
+ # about its words.
1825
1984
  #
1826
- # **See also:**
1827
- # * [Working with custom
1828
- # words](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingWords)
1829
- # * [Add words to the custom language
1830
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addWords).
1985
+ # **See also:** [Listing words from a custom language
1986
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageWords#listWords).
1831
1987
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1832
1988
  # the request. You must make the request with credentials for the instance of the
1833
1989
  # service that owns the custom model.
1834
- # @param words [Array[CustomWord]] An array of `CustomWord` objects that provides information about each custom word
1835
- # that is to be added to or updated in the custom language model.
1836
- # @return [nil]
1837
- def add_words(customization_id:, words:)
1990
+ # @param word_name [String] The custom word that is to be read from the custom language model. URL-encode the
1991
+ # word if it includes non-ASCII characters. For more information, see [Character
1992
+ # encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#charEncoding).
1993
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1994
+ def get_word(customization_id:, word_name:)
1838
1995
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1839
1996
 
1840
- raise ArgumentError.new("words must be provided") if words.nil?
1997
+ raise ArgumentError.new("word_name must be provided") if word_name.nil?
1841
1998
 
1842
1999
  headers = {
1843
2000
  }
1844
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "add_words")
2001
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "get_word")
1845
2002
  headers.merge!(sdk_headers)
1846
2003
 
1847
- data = {
1848
- "words" => words
1849
- }
1850
-
1851
- method_url = "/v1/customizations/%s/words" % [ERB::Util.url_encode(customization_id)]
2004
+ method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]
1852
2005
 
1853
- request(
1854
- method: "POST",
2006
+ response = request(
2007
+ method: "GET",
1855
2008
  url: method_url,
1856
2009
  headers: headers,
1857
- json: data,
1858
2010
  accept_json: true
1859
2011
  )
1860
- nil
2012
+ response
1861
2013
  end
1862
2014
 
1863
2015
  ##
@@ -1872,13 +2024,13 @@ module IBMWatson
1872
2024
  # instance of the service that owns a model to delete its words.
1873
2025
  #
1874
2026
  # **See also:** [Deleting a word from a custom language
1875
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-words.html#deleteWord).
2027
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageWords#deleteWord).
1876
2028
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1877
2029
  # the request. You must make the request with credentials for the instance of the
1878
2030
  # service that owns the custom model.
1879
2031
  # @param word_name [String] The custom word that is to be deleted from the custom language model. URL-encode
1880
2032
  # the word if it includes non-ASCII characters. For more information, see [Character
1881
- # encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
2033
+ # encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-corporaWords#charEncoding).
1882
2034
  # @return [nil]
1883
2035
  def delete_word(customization_id:, word_name:)
1884
2036
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
@@ -1900,100 +2052,42 @@ module IBMWatson
1900
2052
  )
1901
2053
  nil
1902
2054
  end
2055
+ #########################
2056
+ # Custom grammars
2057
+ #########################
1903
2058
 
1904
2059
  ##
1905
- # @!method get_word(customization_id:, word_name:)
1906
- # Get a custom word.
1907
- # Gets information about a custom word from a custom language model. You must use
1908
- # credentials for the instance of the service that owns a model to list information
1909
- # about its words.
1910
- #
1911
- # **See also:** [Listing words from a custom language
1912
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-words.html#listWords).
1913
- # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1914
- # the request. You must make the request with credentials for the instance of the
1915
- # service that owns the custom model.
1916
- # @param word_name [String] The custom word that is to be read from the custom language model. URL-encode the
1917
- # word if it includes non-ASCII characters. For more information, see [Character
1918
- # encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
1919
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1920
- def get_word(customization_id:, word_name:)
1921
- raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1922
-
1923
- raise ArgumentError.new("word_name must be provided") if word_name.nil?
1924
-
1925
- headers = {
1926
- }
1927
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "get_word")
1928
- headers.merge!(sdk_headers)
1929
-
1930
- method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]
1931
-
1932
- response = request(
1933
- method: "GET",
1934
- url: method_url,
1935
- headers: headers,
1936
- accept_json: true
1937
- )
1938
- response
1939
- end
1940
-
1941
- ##
1942
- # @!method list_words(customization_id:, word_type: nil, sort: nil)
1943
- # List custom words.
1944
- # Lists information about custom words from a custom language model. You can list
1945
- # all words from the custom model's words resource, only custom words that were
1946
- # added or modified by the user, or only out-of-vocabulary (OOV) words that were
1947
- # extracted from corpora or are recognized by grammars. You can also indicate the
1948
- # order in which the service is to return words; by default, the service lists words
1949
- # in ascending alphabetical order. You must use credentials for the instance of the
1950
- # service that owns a model to list information about its words.
2060
+ # @!method list_grammars(customization_id:)
2061
+ # List grammars.
2062
+ # Lists information about all grammars from a custom language model. The information
2063
+ # includes the total number of out-of-vocabulary (OOV) words, name, and status of
2064
+ # each grammar. You must use credentials for the instance of the service that owns a
2065
+ # model to list its grammars.
1951
2066
  #
1952
- # **See also:** [Listing words from a custom language
1953
- # model](https://cloud.ibm.com/docs/services/speech-to-text/language-words.html#listWords).
2067
+ # **See also:** [Listing grammars from a custom language
2068
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageGrammars#listGrammars).
1954
2069
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
1955
2070
  # the request. You must make the request with credentials for the instance of the
1956
2071
  # service that owns the custom model.
1957
- # @param word_type [String] The type of words to be listed from the custom language model's words resource:
1958
- # * `all` (the default) shows all words.
1959
- # * `user` shows only custom words that were added or modified by the user directly.
1960
- # * `corpora` shows only OOV that were extracted from corpora.
1961
- # * `grammars` shows only OOV words that are recognized by grammars.
1962
- # @param sort [String] Indicates the order in which the words are to be listed, `alphabetical` or by
1963
- # `count`. You can prepend an optional `+` or `-` to an argument to indicate whether
1964
- # the results are to be sorted in ascending or descending order. By default, words
1965
- # are sorted in ascending alphabetical order. For alphabetical ordering, the
1966
- # lexicographical precedence is numeric values, uppercase letters, and lowercase
1967
- # letters. For count ordering, values with the same count are ordered
1968
- # alphabetically. With the `curl` command, URL encode the `+` symbol as `%2B`.
1969
2072
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1970
- def list_words(customization_id:, word_type: nil, sort: nil)
2073
+ def list_grammars(customization_id:)
1971
2074
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
1972
2075
 
1973
2076
  headers = {
1974
2077
  }
1975
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_words")
2078
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_grammars")
1976
2079
  headers.merge!(sdk_headers)
1977
2080
 
1978
- params = {
1979
- "word_type" => word_type,
1980
- "sort" => sort
1981
- }
1982
-
1983
- method_url = "/v1/customizations/%s/words" % [ERB::Util.url_encode(customization_id)]
2081
+ method_url = "/v1/customizations/%s/grammars" % [ERB::Util.url_encode(customization_id)]
1984
2082
 
1985
2083
  response = request(
1986
2084
  method: "GET",
1987
2085
  url: method_url,
1988
2086
  headers: headers,
1989
- params: params,
1990
2087
  accept_json: true
1991
2088
  )
1992
2089
  response
1993
2090
  end
1994
- #########################
1995
- # Custom grammars
1996
- #########################
1997
2091
 
1998
2092
  ##
1999
2093
  # @!method add_grammar(customization_id:, grammar_name:, grammar_file:, content_type:, allow_overwrite: nil)
@@ -2030,13 +2124,14 @@ module IBMWatson
2030
2124
  #
2031
2125
  # The service limits the overall amount of data that you can add to a custom model
2032
2126
  # to a maximum of 10 million total words from all sources combined. Also, you can
2033
- # add no more than 30 thousand OOV words to a model. This includes words that the
2127
+ # add no more than 90 thousand OOV words to a model. This includes words that the
2034
2128
  # service extracts from corpora and grammars and words that you add directly.
2035
2129
  #
2036
2130
  # **See also:**
2037
- # * [Working with grammars](https://cloud.ibm.com/docs/services/speech-to-text/)
2038
- # * [Add grammars to the custom language
2039
- # model](https://cloud.ibm.com/docs/services/speech-to-text/).
2131
+ # * [Understanding
2132
+ # grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarUnderstand#grammarUnderstand)
2133
+ # * [Add a grammar to the custom language
2134
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-grammarAdd#addGrammar).
2040
2135
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
2041
2136
  # the request. You must make the request with credentials for the instance of the
2042
2137
  # service that owns the custom model.
@@ -2054,6 +2149,9 @@ module IBMWatson
2054
2149
  # Using any other encoding can lead to issues when compiling the grammar or to
2055
2150
  # unexpected results in decoding. The service ignores an encoding that is specified
2056
2151
  # in the header of the grammar.
2152
+ #
2153
+ # With the `curl` command, use the `--data-binary` option to upload the file for the
2154
+ # request.
2057
2155
  # @param content_type [String] The format (MIME type) of the grammar file:
2058
2156
  # * `application/srgs` for Augmented Backus-Naur Form (ABNF), which uses a
2059
2157
  # plain-text representation that is similar to traditional BNF grammars.
@@ -2098,45 +2196,6 @@ module IBMWatson
2098
2196
  nil
2099
2197
  end
2100
2198
 
2101
- ##
2102
- # @!method delete_grammar(customization_id:, grammar_name:)
2103
- # Delete a grammar.
2104
- # Deletes an existing grammar from a custom language model. The service removes any
2105
- # out-of-vocabulary (OOV) words associated with the grammar from the custom model's
2106
- # words resource unless they were also added by another resource or they were
2107
- # modified in some way with the **Add custom words** or **Add a custom word**
2108
- # method. Removing a grammar does not affect the custom model until you train the
2109
- # model with the **Train a custom language model** method. You must use credentials
2110
- # for the instance of the service that owns a model to delete its grammar.
2111
- #
2112
- # **See also:** [Deleting a grammar from a custom language
2113
- # model](https://cloud.ibm.com/docs/services/speech-to-text/).
2114
- # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
2115
- # the request. You must make the request with credentials for the instance of the
2116
- # service that owns the custom model.
2117
- # @param grammar_name [String] The name of the grammar for the custom language model.
2118
- # @return [nil]
2119
- def delete_grammar(customization_id:, grammar_name:)
2120
- raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2121
-
2122
- raise ArgumentError.new("grammar_name must be provided") if grammar_name.nil?
2123
-
2124
- headers = {
2125
- }
2126
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_grammar")
2127
- headers.merge!(sdk_headers)
2128
-
2129
- method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
2130
-
2131
- request(
2132
- method: "DELETE",
2133
- url: method_url,
2134
- headers: headers,
2135
- accept_json: true
2136
- )
2137
- nil
2138
- end
2139
-
2140
2199
  ##
2141
2200
  # @!method get_grammar(customization_id:, grammar_name:)
2142
2201
  # Get a grammar.
@@ -2146,7 +2205,7 @@ module IBMWatson
2146
2205
  # model to list its grammars.
2147
2206
  #
2148
2207
  # **See also:** [Listing grammars from a custom language
2149
- # model](https://cloud.ibm.com/docs/services/speech-to-text/).
2208
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageGrammars#listGrammars).
2150
2209
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
2151
2210
  # the request. You must make the request with credentials for the instance of the
2152
2211
  # service that owns the custom model.
@@ -2174,36 +2233,42 @@ module IBMWatson
2174
2233
  end
2175
2234
 
2176
2235
  ##
2177
- # @!method list_grammars(customization_id:)
2178
- # List grammars.
2179
- # Lists information about all grammars from a custom language model. The information
2180
- # includes the total number of out-of-vocabulary (OOV) words, name, and status of
2181
- # each grammar. You must use credentials for the instance of the service that owns a
2182
- # model to list its grammars.
2236
+ # @!method delete_grammar(customization_id:, grammar_name:)
2237
+ # Delete a grammar.
2238
+ # Deletes an existing grammar from a custom language model. The service removes any
2239
+ # out-of-vocabulary (OOV) words associated with the grammar from the custom model's
2240
+ # words resource unless they were also added by another resource or they were
2241
+ # modified in some way with the **Add custom words** or **Add a custom word**
2242
+ # method. Removing a grammar does not affect the custom model until you train the
2243
+ # model with the **Train a custom language model** method. You must use credentials
2244
+ # for the instance of the service that owns a model to delete its grammar.
2183
2245
  #
2184
- # **See also:** [Listing grammars from a custom language
2185
- # model](https://cloud.ibm.com/docs/services/speech-to-text/).
2246
+ # **See also:** [Deleting a grammar from a custom language
2247
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageGrammars#deleteGrammar).
2186
2248
  # @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
2187
2249
  # the request. You must make the request with credentials for the instance of the
2188
2250
  # service that owns the custom model.
2189
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2190
- def list_grammars(customization_id:)
2251
+ # @param grammar_name [String] The name of the grammar for the custom language model.
2252
+ # @return [nil]
2253
+ def delete_grammar(customization_id:, grammar_name:)
2191
2254
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2192
2255
 
2256
+ raise ArgumentError.new("grammar_name must be provided") if grammar_name.nil?
2257
+
2193
2258
  headers = {
2194
2259
  }
2195
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_grammars")
2260
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_grammar")
2196
2261
  headers.merge!(sdk_headers)
2197
2262
 
2198
- method_url = "/v1/customizations/%s/grammars" % [ERB::Util.url_encode(customization_id)]
2263
+ method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
2199
2264
 
2200
- response = request(
2201
- method: "GET",
2265
+ request(
2266
+ method: "DELETE",
2202
2267
  url: method_url,
2203
2268
  headers: headers,
2204
2269
  accept_json: true
2205
2270
  )
2206
- response
2271
+ nil
2207
2272
  end
2208
2273
  #########################
2209
2274
  # Custom acoustic models
@@ -2218,7 +2283,7 @@ module IBMWatson
2218
2283
  # it.
2219
2284
  #
2220
2285
  # **See also:** [Create a custom acoustic
2221
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#createModel-acoustic).
2286
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-acoustic#createModel-acoustic).
2222
2287
  # @param name [String] A user-defined name for the new custom acoustic model. Use a name that is unique
2223
2288
  # among all custom acoustic models that you own. Use a localized name that matches
2224
2289
  # the language of the custom model. Use a name that describes the acoustic
@@ -2230,7 +2295,7 @@ module IBMWatson
2230
2295
  #
2231
2296
  # To determine whether a base model supports acoustic model customization, refer to
2232
2297
  # [Language support for
2233
- # customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
2298
+ # customization](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customization#languageSupport).
2234
2299
  # @param description [String] A description of the new custom acoustic model. Use a localized description that
2235
2300
  # matches the language of the custom model.
2236
2301
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
@@ -2263,36 +2328,40 @@ module IBMWatson
2263
2328
  end
2264
2329
 
2265
2330
  ##
2266
- # @!method delete_acoustic_model(customization_id:)
2267
- # Delete a custom acoustic model.
2268
- # Deletes an existing custom acoustic model. The custom model cannot be deleted if
2269
- # another request, such as adding an audio resource to the model, is currently being
2270
- # processed. You must use credentials for the instance of the service that owns a
2271
- # model to delete it.
2331
+ # @!method list_acoustic_models(language: nil)
2332
+ # List custom acoustic models.
2333
+ # Lists information about all custom acoustic models that are owned by an instance
2334
+ # of the service. Use the `language` parameter to see all custom acoustic models for
2335
+ # the specified language. Omit the parameter to see all custom acoustic models for
2336
+ # all languages. You must use credentials for the instance of the service that owns
2337
+ # a model to list information about it.
2272
2338
  #
2273
- # **See also:** [Deleting a custom acoustic
2274
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#deleteModel-acoustic).
2275
- # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2276
- # the request. You must make the request with credentials for the instance of the
2277
- # service that owns the custom model.
2278
- # @return [nil]
2279
- def delete_acoustic_model(customization_id:)
2280
- raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2281
-
2339
+ # **See also:** [Listing custom acoustic
2340
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic).
2341
+ # @param language [String] The identifier of the language for which custom language or custom acoustic models
2342
+ # are to be returned (for example, `en-US`). Omit the parameter to see all custom
2343
+ # language or custom acoustic models that are owned by the requesting credentials.
2344
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2345
+ def list_acoustic_models(language: nil)
2282
2346
  headers = {
2283
2347
  }
2284
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_acoustic_model")
2348
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_acoustic_models")
2285
2349
  headers.merge!(sdk_headers)
2286
2350
 
2287
- method_url = "/v1/acoustic_customizations/%s" % [ERB::Util.url_encode(customization_id)]
2351
+ params = {
2352
+ "language" => language
2353
+ }
2288
2354
 
2289
- request(
2290
- method: "DELETE",
2355
+ method_url = "/v1/acoustic_customizations"
2356
+
2357
+ response = request(
2358
+ method: "GET",
2291
2359
  url: method_url,
2292
2360
  headers: headers,
2361
+ params: params,
2293
2362
  accept_json: true
2294
2363
  )
2295
- nil
2364
+ response
2296
2365
  end
2297
2366
 
2298
2367
  ##
@@ -2302,7 +2371,7 @@ module IBMWatson
2302
2371
  # for the instance of the service that owns a model to list information about it.
2303
2372
  #
2304
2373
  # **See also:** [Listing custom acoustic
2305
- # models](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#listModels-acoustic).
2374
+ # models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic).
2306
2375
  # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2307
2376
  # the request. You must make the request with credentials for the instance of the
2308
2377
  # service that owns the custom model.
@@ -2327,69 +2396,31 @@ module IBMWatson
2327
2396
  end
2328
2397
 
2329
2398
  ##
2330
- # @!method list_acoustic_models(language: nil)
2331
- # List custom acoustic models.
2332
- # Lists information about all custom acoustic models that are owned by an instance
2333
- # of the service. Use the `language` parameter to see all custom acoustic models for
2334
- # the specified language. Omit the parameter to see all custom acoustic models for
2335
- # all languages. You must use credentials for the instance of the service that owns
2336
- # a model to list information about it.
2337
- #
2338
- # **See also:** [Listing custom acoustic
2339
- # models](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#listModels-acoustic).
2340
- # @param language [String] The identifier of the language for which custom language or custom acoustic models
2341
- # are to be returned (for example, `en-US`). Omit the parameter to see all custom
2342
- # language or custom acoustic models that are owned by the requesting credentials.
2343
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2344
- def list_acoustic_models(language: nil)
2345
- headers = {
2346
- }
2347
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_acoustic_models")
2348
- headers.merge!(sdk_headers)
2349
-
2350
- params = {
2351
- "language" => language
2352
- }
2353
-
2354
- method_url = "/v1/acoustic_customizations"
2355
-
2356
- response = request(
2357
- method: "GET",
2358
- url: method_url,
2359
- headers: headers,
2360
- params: params,
2361
- accept_json: true
2362
- )
2363
- response
2364
- end
2365
-
2366
- ##
2367
- # @!method reset_acoustic_model(customization_id:)
2368
- # Reset a custom acoustic model.
2369
- # Resets a custom acoustic model by removing all audio resources from the model.
2370
- # Resetting a custom acoustic model initializes the model to its state when it was
2371
- # first created. Metadata such as the name and language of the model are preserved,
2372
- # but the model's audio resources are removed and must be re-created. You must use
2373
- # credentials for the instance of the service that owns a model to reset it.
2399
+ # @!method delete_acoustic_model(customization_id:)
2400
+ # Delete a custom acoustic model.
2401
+ # Deletes an existing custom acoustic model. The custom model cannot be deleted if
2402
+ # another request, such as adding an audio resource to the model, is currently being
2403
+ # processed. You must use credentials for the instance of the service that owns a
2404
+ # model to delete it.
2374
2405
  #
2375
- # **See also:** [Resetting a custom acoustic
2376
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#resetModel-acoustic).
2406
+ # **See also:** [Deleting a custom acoustic
2407
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#deleteModel-acoustic).
2377
2408
  # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2378
2409
  # the request. You must make the request with credentials for the instance of the
2379
2410
  # service that owns the custom model.
2380
2411
  # @return [nil]
2381
- def reset_acoustic_model(customization_id:)
2412
+ def delete_acoustic_model(customization_id:)
2382
2413
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2383
2414
 
2384
2415
  headers = {
2385
2416
  }
2386
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "reset_acoustic_model")
2417
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_acoustic_model")
2387
2418
  headers.merge!(sdk_headers)
2388
2419
 
2389
- method_url = "/v1/acoustic_customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
2420
+ method_url = "/v1/acoustic_customizations/%s" % [ERB::Util.url_encode(customization_id)]
2390
2421
 
2391
2422
  request(
2392
- method: "POST",
2423
+ method: "DELETE",
2393
2424
  url: method_url,
2394
2425
  headers: headers,
2395
2426
  accept_json: true
@@ -2431,18 +2462,23 @@ module IBMWatson
2431
2462
  # files. Both of the custom models must be based on the same version of the same
2432
2463
  # base model for training to succeed.
2433
2464
  #
2434
- # Training can fail to start for the following reasons:
2465
+ # **See also:**
2466
+ # * [Train the custom acoustic
2467
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-acoustic#trainModel-acoustic)
2468
+ # * [Using custom acoustic and custom language models
2469
+ # together](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-useBoth#useBoth)
2470
+ #
2471
+ #
2472
+ # ### Training failures
2473
+ #
2474
+ # Training can fail to start for the following reasons:
2435
2475
  # * The service is currently handling another request for the custom model, such as
2436
2476
  # another training request or a request to add audio resources to the model.
2437
- # * The custom model contains less than 10 minutes or more than 100 hours of audio
2477
+ # * The custom model contains less than 10 minutes or more than 200 hours of audio
2438
2478
  # data.
2439
- # * One or more of the custom model's audio resources is invalid.
2440
2479
  # * You passed an incompatible custom language model with the
2441
2480
  # `custom_language_model_id` query parameter. Both custom models must be based on
2442
2481
  # the same version of the same base model.
2443
- #
2444
- # **See also:** [Train the custom acoustic
2445
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#trainModel-acoustic).
2446
2482
  # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2447
2483
  # the request. You must make the request with credentials for the instance of the
2448
2484
  # service that owns the custom model.
@@ -2453,7 +2489,7 @@ module IBMWatson
2453
2489
  # language model must be based on the same version of the same base model as the
2454
2490
  # custom acoustic model. The credentials specified with the request must own both
2455
2491
  # custom models.
2456
- # @return [nil]
2492
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2457
2493
  def train_acoustic_model(customization_id:, custom_language_model_id: nil)
2458
2494
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2459
2495
 
@@ -2468,13 +2504,47 @@ module IBMWatson
2468
2504
 
2469
2505
  method_url = "/v1/acoustic_customizations/%s/train" % [ERB::Util.url_encode(customization_id)]
2470
2506
 
2471
- request(
2507
+ response = request(
2472
2508
  method: "POST",
2473
2509
  url: method_url,
2474
2510
  headers: headers,
2475
2511
  params: params,
2476
2512
  accept_json: true
2477
2513
  )
2514
+ response
2515
+ end
2516
+
2517
+ ##
2518
+ # @!method reset_acoustic_model(customization_id:)
2519
+ # Reset a custom acoustic model.
2520
+ # Resets a custom acoustic model by removing all audio resources from the model.
2521
+ # Resetting a custom acoustic model initializes the model to its state when it was
2522
+ # first created. Metadata such as the name and language of the model are preserved,
2523
+ # but the model's audio resources are removed and must be re-created. You must use
2524
+ # credentials for the instance of the service that owns a model to reset it.
2525
+ #
2526
+ # **See also:** [Resetting a custom acoustic
2527
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAcousticModels#resetModel-acoustic).
2528
+ # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2529
+ # the request. You must make the request with credentials for the instance of the
2530
+ # service that owns the custom model.
2531
+ # @return [nil]
2532
+ def reset_acoustic_model(customization_id:)
2533
+ raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2534
+
2535
+ headers = {
2536
+ }
2537
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "reset_acoustic_model")
2538
+ headers.merge!(sdk_headers)
2539
+
2540
+ method_url = "/v1/acoustic_customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
2541
+
2542
+ request(
2543
+ method: "POST",
2544
+ url: method_url,
2545
+ headers: headers,
2546
+ accept_json: true
2547
+ )
2478
2548
  nil
2479
2549
  end
2480
2550
 
@@ -2505,7 +2575,7 @@ module IBMWatson
2505
2575
  # acoustic model was not trained with a custom language model.
2506
2576
  #
2507
2577
  # **See also:** [Upgrading a custom acoustic
2508
- # model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic).
2578
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customUpgrade#upgradeAcoustic).
2509
2579
  # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2510
2580
  # the request. You must make the request with credentials for the instance of the
2511
2581
  # service that owns the custom model.
@@ -2518,7 +2588,7 @@ module IBMWatson
2518
2588
  # upgrade of a custom acoustic model that is trained with a custom language model,
2519
2589
  # and only if you receive a 400 response code and the message `No input data
2520
2590
  # modified since last training`. See [Upgrading a custom acoustic
2521
- # model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic).
2591
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-customUpgrade#upgradeAcoustic).
2522
2592
  # @return [nil]
2523
2593
  def upgrade_acoustic_model(customization_id:, custom_language_model_id: nil, force: nil)
2524
2594
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
@@ -2548,6 +2618,41 @@ module IBMWatson
2548
2618
  # Custom audio resources
2549
2619
  #########################
2550
2620
 
2621
+ ##
2622
+ # @!method list_audio(customization_id:)
2623
+ # List audio resources.
2624
+ # Lists information about all audio resources from a custom acoustic model. The
2625
+ # information includes the name of the resource and information about its audio
2626
+ # data, such as its duration. It also includes the status of the audio resource,
2627
+ # which is important for checking the service's analysis of the resource in response
2628
+ # to a request to add it to the custom acoustic model. You must use credentials for
2629
+ # the instance of the service that owns a model to list its audio resources.
2630
+ #
2631
+ # **See also:** [Listing audio resources for a custom acoustic
2632
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAudio#listAudio).
2633
+ # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2634
+ # the request. You must make the request with credentials for the instance of the
2635
+ # service that owns the custom model.
2636
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2637
+ def list_audio(customization_id:)
2638
+ raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2639
+
2640
+ headers = {
2641
+ }
2642
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_audio")
2643
+ headers.merge!(sdk_headers)
2644
+
2645
+ method_url = "/v1/acoustic_customizations/%s/audio" % [ERB::Util.url_encode(customization_id)]
2646
+
2647
+ response = request(
2648
+ method: "GET",
2649
+ url: method_url,
2650
+ headers: headers,
2651
+ accept_json: true
2652
+ )
2653
+ response
2654
+ end
2655
+
2551
2656
  ##
2552
2657
  # @!method add_audio(customization_id:, audio_name:, audio_resource:, contained_content_type: nil, allow_overwrite: nil, content_type: nil)
2553
2658
  # Add an audio resource.
@@ -2566,7 +2671,7 @@ module IBMWatson
2566
2671
  # You can use this method to add any number of audio resources to a custom model by
2567
2672
  # calling the method once for each audio or archive file. But the addition of one
2568
2673
  # audio resource must be fully complete before you can add another. You must add a
2569
- # minimum of 10 minutes and a maximum of 100 hours of audio that includes speech,
2674
+ # minimum of 10 minutes and a maximum of 200 hours of audio that includes speech,
2570
2675
  # not just silence, to a custom acoustic model before you can train it. No audio
2571
2676
  # resource, audio- or archive-type, can be larger than 100 MB. To add an audio
2572
2677
  # resource that has the same name as an existing audio resource, set the
@@ -2588,7 +2693,7 @@ module IBMWatson
2588
2693
  # every few seconds until it becomes `ok`.
2589
2694
  #
2590
2695
  # **See also:** [Add audio to the custom acoustic
2591
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#addAudio).
2696
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-acoustic#addAudio).
2592
2697
  #
2593
2698
  #
2594
2699
  # ### Content types for audio-type resources
@@ -2622,7 +2727,8 @@ module IBMWatson
2622
2727
  # service labels the audio file as `invalid`.
2623
2728
  #
2624
2729
  # **See also:** [Audio
2625
- # formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
2730
+ # formats](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-audio-formats#audio-formats).
2731
+ #
2626
2732
  #
2627
2733
  # ### Content types for archive-type resources
2628
2734
  #
@@ -2669,6 +2775,9 @@ module IBMWatson
2669
2775
  # custom model.
2670
2776
  # @param audio_resource [String] The audio resource that is to be added to the custom acoustic model, an individual
2671
2777
  # audio file or an archive file.
2778
+ #
2779
+ # With the `curl` command, use the `--data-binary` option to upload the file for the
2780
+ # request.
2672
2781
  # @param contained_content_type [String] **For an archive-type resource,** specify the format of the audio files that are
2673
2782
  # contained in the archive file if they are of type `audio/alaw`, `audio/basic`,
2674
2783
  # `audio/l16`, or `audio/mulaw`. Include the `rate`, `channels`, and `endianness`
@@ -2729,45 +2838,6 @@ module IBMWatson
2729
2838
  nil
2730
2839
  end
2731
2840
 
2732
- ##
2733
- # @!method delete_audio(customization_id:, audio_name:)
2734
- # Delete an audio resource.
2735
- # Deletes an existing audio resource from a custom acoustic model. Deleting an
2736
- # archive-type audio resource removes the entire archive of files; the current
2737
- # interface does not allow deletion of individual files from an archive resource.
2738
- # Removing an audio resource does not affect the custom model until you train the
2739
- # model on its updated data by using the **Train a custom acoustic model** method.
2740
- # You must use credentials for the instance of the service that owns a model to
2741
- # delete its audio resources.
2742
- #
2743
- # **See also:** [Deleting an audio resource from a custom acoustic
2744
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#deleteAudio).
2745
- # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2746
- # the request. You must make the request with credentials for the instance of the
2747
- # service that owns the custom model.
2748
- # @param audio_name [String] The name of the audio resource for the custom acoustic model.
2749
- # @return [nil]
2750
- def delete_audio(customization_id:, audio_name:)
2751
- raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2752
-
2753
- raise ArgumentError.new("audio_name must be provided") if audio_name.nil?
2754
-
2755
- headers = {
2756
- }
2757
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_audio")
2758
- headers.merge!(sdk_headers)
2759
-
2760
- method_url = "/v1/acoustic_customizations/%s/audio/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(audio_name)]
2761
-
2762
- request(
2763
- method: "DELETE",
2764
- url: method_url,
2765
- headers: headers,
2766
- accept_json: true
2767
- )
2768
- nil
2769
- end
2770
-
2771
2841
  ##
2772
2842
  # @!method get_audio(customization_id:, audio_name:)
2773
2843
  # Get an audio resource.
@@ -2793,7 +2863,7 @@ module IBMWatson
2793
2863
  # its audio resources.
2794
2864
  #
2795
2865
  # **See also:** [Listing audio resources for a custom acoustic
2796
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#listAudio).
2866
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAudio#listAudio).
2797
2867
  # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2798
2868
  # the request. You must make the request with credentials for the instance of the
2799
2869
  # service that owns the custom model.
@@ -2821,38 +2891,42 @@ module IBMWatson
2821
2891
  end
2822
2892
 
2823
2893
  ##
2824
- # @!method list_audio(customization_id:)
2825
- # List audio resources.
2826
- # Lists information about all audio resources from a custom acoustic model. The
2827
- # information includes the name of the resource and information about its audio
2828
- # data, such as its duration. It also includes the status of the audio resource,
2829
- # which is important for checking the service's analysis of the resource in response
2830
- # to a request to add it to the custom acoustic model. You must use credentials for
2831
- # the instance of the service that owns a model to list its audio resources.
2894
+ # @!method delete_audio(customization_id:, audio_name:)
2895
+ # Delete an audio resource.
2896
+ # Deletes an existing audio resource from a custom acoustic model. Deleting an
2897
+ # archive-type audio resource removes the entire archive of files; the current
2898
+ # interface does not allow deletion of individual files from an archive resource.
2899
+ # Removing an audio resource does not affect the custom model until you train the
2900
+ # model on its updated data by using the **Train a custom acoustic model** method.
2901
+ # You must use credentials for the instance of the service that owns a model to
2902
+ # delete its audio resources.
2832
2903
  #
2833
- # **See also:** [Listing audio resources for a custom acoustic
2834
- # model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#listAudio).
2904
+ # **See also:** [Deleting an audio resource from a custom acoustic
2905
+ # model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-manageAudio#deleteAudio).
2835
2906
  # @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
2836
2907
  # the request. You must make the request with credentials for the instance of the
2837
2908
  # service that owns the custom model.
2838
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2839
- def list_audio(customization_id:)
2909
+ # @param audio_name [String] The name of the audio resource for the custom acoustic model.
2910
+ # @return [nil]
2911
+ def delete_audio(customization_id:, audio_name:)
2840
2912
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
2841
2913
 
2914
+ raise ArgumentError.new("audio_name must be provided") if audio_name.nil?
2915
+
2842
2916
  headers = {
2843
2917
  }
2844
- sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "list_audio")
2918
+ sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "delete_audio")
2845
2919
  headers.merge!(sdk_headers)
2846
2920
 
2847
- method_url = "/v1/acoustic_customizations/%s/audio" % [ERB::Util.url_encode(customization_id)]
2921
+ method_url = "/v1/acoustic_customizations/%s/audio/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(audio_name)]
2848
2922
 
2849
- response = request(
2850
- method: "GET",
2923
+ request(
2924
+ method: "DELETE",
2851
2925
  url: method_url,
2852
2926
  headers: headers,
2853
2927
  accept_json: true
2854
2928
  )
2855
- response
2929
+ nil
2856
2930
  end
2857
2931
  #########################
2858
2932
  # User data
@@ -2871,7 +2945,7 @@ module IBMWatson
2871
2945
  # with a request that passes the data.
2872
2946
  #
2873
2947
  # **See also:** [Information
2874
- # security](https://cloud.ibm.com/docs/services/speech-to-text/information-security.html).
2948
+ # security](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-information-security#information-security).
2875
2949
  # @param customer_id [String] The customer ID for which all data is to be deleted.
2876
2950
  # @return [nil]
2877
2951
  def delete_user_data(customer_id:)