ibm_watson 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -2
- data/lib/ibm_watson/assistant_v1.rb +7 -7
- data/lib/ibm_watson/discovery_v1.rb +206 -1
- data/lib/ibm_watson/speech_to_text_v1.rb +619 -276
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +8 -11
- data/lib/ibm_watson/watson_service.rb +19 -2
- data/test/integration/test_discovery_v1.rb +27 -1
- data/test/integration/test_speech_to_text_v1.rb +1 -0
- data/test/unit/test_configure_http_client.rb +10 -0
- data/test/unit/test_discovery_v1.rb +124 -0
- data/test/unit/test_speech_to_text_v1.rb +81 -0
- data/test/unit/test_watson_service.rb +44 -0
- metadata +8 -8
@@ -30,8 +30,12 @@
|
|
30
30
|
# The service also offers two customization interfaces. Use language model customization
|
31
31
|
# to expand the vocabulary of a base model with domain-specific terminology. Use acoustic
|
32
32
|
# model customization to adapt a base model for the acoustic characteristics of your
|
33
|
-
# audio.
|
34
|
-
#
|
33
|
+
# audio. For language model customization, the service also supports grammars. A grammar
|
34
|
+
# is a formal language specification that lets you restrict the phrases that the service
|
35
|
+
# can recognize.
|
36
|
+
#
|
37
|
+
# Language model customization is generally available for production use with most
|
38
|
+
# supported languages. Acoustic model customization is beta functionality that is
|
35
39
|
# available for all supported languages.
|
36
40
|
|
37
41
|
require "concurrent"
|
@@ -100,7 +104,7 @@ module IBMWatson
|
|
100
104
|
# among other things.
|
101
105
|
#
|
102
106
|
# **See also:** [Languages and
|
103
|
-
# models](https://
|
107
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
|
104
108
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
105
109
|
def list_models
|
106
110
|
headers = {
|
@@ -125,7 +129,7 @@ module IBMWatson
|
|
125
129
|
# sampling rate in Hertz, among other things.
|
126
130
|
#
|
127
131
|
# **See also:** [Languages and
|
128
|
-
# models](https://
|
132
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
|
129
133
|
# @param model_id [String] The identifier of the model in the form of its name from the output of the **Get a
|
130
134
|
# model** method.
|
131
135
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
@@ -150,7 +154,7 @@ module IBMWatson
|
|
150
154
|
#########################
|
151
155
|
|
152
156
|
##
|
153
|
-
# @!method recognize(audio:, content_type: nil, 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)
|
157
|
+
# @!method recognize(audio:, content_type: nil, 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)
|
154
158
|
# Recognize audio.
|
155
159
|
# Sends audio and returns transcription results for a recognition request. You can
|
156
160
|
# pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The
|
@@ -160,7 +164,8 @@ module IBMWatson
|
|
160
164
|
# the WebSocket API.
|
161
165
|
#
|
162
166
|
# **See also:** [Making a basic HTTP
|
163
|
-
# request](https://
|
167
|
+
# request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-basic).
|
168
|
+
#
|
164
169
|
#
|
165
170
|
# ### Streaming mode
|
166
171
|
#
|
@@ -173,8 +178,11 @@ module IBMWatson
|
|
173
178
|
# `inactivity_timeout` parameter to change the default of 30 seconds.
|
174
179
|
#
|
175
180
|
# **See also:**
|
176
|
-
# * [Audio
|
177
|
-
#
|
181
|
+
# * [Audio
|
182
|
+
# transmission](https://cloud.ibm.com/docs/services/speech-to-text/input.html#transmission)
|
183
|
+
# *
|
184
|
+
# [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts)
|
185
|
+
#
|
178
186
|
#
|
179
187
|
# ### Audio formats (content types)
|
180
188
|
#
|
@@ -190,6 +198,7 @@ module IBMWatson
|
|
190
198
|
# can optionally include the number of channels and the endianness of the audio.
|
191
199
|
# * `audio/basic` (**Required.** Use only with narrowband models.)
|
192
200
|
# * `audio/flac`
|
201
|
+
# * `audio/g729` (Use only with narrowband models.)
|
193
202
|
# * `audio/l16` (**Required.** Specify the sampling rate (`rate`) and optionally the
|
194
203
|
# number of channels (`channels`) and endianness (`endianness`) of the audio.)
|
195
204
|
# * `audio/mp3`
|
@@ -203,7 +212,15 @@ module IBMWatson
|
|
203
212
|
# * `audio/webm;codecs=opus`
|
204
213
|
# * `audio/webm;codecs=vorbis`
|
205
214
|
#
|
206
|
-
#
|
215
|
+
# The sampling rate of the audio must match the sampling rate of the model for the
|
216
|
+
# recognition request: for broadband models, at least 16 kHz; for narrowband models,
|
217
|
+
# at least 8 kHz. If the sampling rate of the audio is higher than the minimum
|
218
|
+
# required rate, the service down-samples the audio to the appropriate rate. If the
|
219
|
+
# sampling rate of the audio is lower than the minimum required rate, the request
|
220
|
+
# fails.
|
221
|
+
#
|
222
|
+
# **See also:** [Audio
|
223
|
+
# formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
|
207
224
|
#
|
208
225
|
# ### Multipart speech recognition
|
209
226
|
#
|
@@ -220,32 +237,34 @@ module IBMWatson
|
|
220
237
|
# example, if you want to spot a very large number of keywords.
|
221
238
|
#
|
222
239
|
# **See also:** [Making a multipart HTTP
|
223
|
-
# request](https://
|
240
|
+
# request](https://cloud.ibm.com/docs/services/speech-to-text/http.html#HTTP-multi).
|
224
241
|
# @param audio [String] The audio to transcribe.
|
225
242
|
# @param content_type [String] The format (MIME type) of the audio. For more information about specifying an
|
226
243
|
# audio format, see **Audio formats (content types)** in the method description.
|
227
|
-
# @param model [String] The identifier of the model that is to be used for the recognition request.
|
244
|
+
# @param model [String] The identifier of the model that is to be used for the recognition request. See
|
245
|
+
# [Languages and
|
246
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
|
228
247
|
# @param language_customization_id [String] The customization ID (GUID) of a custom language model that is to be used with the
|
229
248
|
# recognition request. The base model of the specified custom language model must
|
230
249
|
# match the model specified with the `model` parameter. You must make the request
|
231
|
-
# with
|
232
|
-
#
|
233
|
-
# models](https://
|
250
|
+
# with credentials for the instance of the service that owns the custom model. By
|
251
|
+
# default, no custom language model is used. See [Custom
|
252
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom).
|
234
253
|
#
|
235
254
|
# **Note:** Use this parameter instead of the deprecated `customization_id`
|
236
255
|
# parameter.
|
237
256
|
# @param acoustic_customization_id [String] The customization ID (GUID) of a custom acoustic model that is to be used with the
|
238
257
|
# recognition request. The base model of the specified custom acoustic model must
|
239
258
|
# match the model specified with the `model` parameter. You must make the request
|
240
|
-
# with
|
241
|
-
#
|
242
|
-
# models](https://
|
259
|
+
# with credentials for the instance of the service that owns the custom model. By
|
260
|
+
# default, no custom acoustic model is used. See [Custom
|
261
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom).
|
243
262
|
# @param base_model_version [String] The version of the specified base model that is to be used with recognition
|
244
263
|
# request. Multiple versions of a base model can exist when a model is updated for
|
245
264
|
# internal improvements. The parameter is intended primarily for use with custom
|
246
265
|
# models that have been upgraded for a new base model. The default value depends on
|
247
266
|
# whether the parameter is used with or without a custom model. See [Base model
|
248
|
-
# version](https://
|
267
|
+
# version](https://cloud.ibm.com/docs/services/speech-to-text/input.html#version).
|
249
268
|
# @param customization_weight [Float] If you specify the customization ID (GUID) of a custom language model with the
|
250
269
|
# recognition request, the customization weight tells the service how much weight to
|
251
270
|
# give to words from the custom language model compared to those from the base model
|
@@ -262,64 +281,94 @@ module IBMWatson
|
|
262
281
|
# custom model's domain, but it can negatively affect performance on non-domain
|
263
282
|
# phrases.
|
264
283
|
#
|
265
|
-
# See [Custom
|
284
|
+
# See [Custom
|
285
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom).
|
266
286
|
# @param inactivity_timeout [Fixnum] The time in seconds after which, if only silence (no speech) is detected in
|
267
287
|
# submitted audio, the connection is closed with a 400 error. The parameter is
|
268
288
|
# useful for stopping audio submission from a live microphone when a user simply
|
269
289
|
# walks away. Use `-1` for infinity. See
|
270
|
-
# [Timeouts](https://
|
290
|
+
# [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts).
|
271
291
|
# @param keywords [Array[String]] An array of keyword strings to spot in the audio. Each keyword string can include
|
272
292
|
# one or more string tokens. Keywords are spotted only in the final results, not in
|
273
293
|
# interim hypotheses. If you specify any keywords, you must also specify a keywords
|
274
294
|
# threshold. You can spot a maximum of 1000 keywords. Omit the parameter or specify
|
275
295
|
# an empty array if you do not need to spot keywords. See [Keyword
|
276
|
-
# spotting](https://
|
296
|
+
# spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
|
277
297
|
# @param keywords_threshold [Float] A confidence value that is the lower bound for spotting a keyword. A word is
|
278
298
|
# considered to match a keyword if its confidence is greater than or equal to the
|
279
|
-
# threshold. Specify a probability between 0.0 and 1.0.
|
280
|
-
#
|
281
|
-
#
|
282
|
-
# spotting](https://
|
299
|
+
# threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold,
|
300
|
+
# you must also specify one or more keywords. The service performs no keyword
|
301
|
+
# spotting if you omit either parameter. See [Keyword
|
302
|
+
# spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
|
283
303
|
# @param max_alternatives [Fixnum] The maximum number of alternative transcripts that the service is to return. By
|
284
|
-
# default, a single
|
285
|
-
# alternatives](https://
|
304
|
+
# default, the service returns a single transcript. See [Maximum
|
305
|
+
# alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#max_alternatives).
|
286
306
|
# @param word_alternatives_threshold [Float] A confidence value that is the lower bound for identifying a hypothesis as a
|
287
307
|
# possible word alternative (also known as \"Confusion Networks\"). An alternative
|
288
308
|
# word is considered if its confidence is greater than or equal to the threshold.
|
289
|
-
# Specify a probability between 0.0 and 1.0.
|
290
|
-
#
|
291
|
-
# alternatives](https://
|
309
|
+
# Specify a probability between 0.0 and 1.0. By default, the service computes no
|
310
|
+
# alternative words. See [Word
|
311
|
+
# alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_alternatives).
|
292
312
|
# @param word_confidence [Boolean] If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for
|
293
|
-
# each word. By default, no word confidence
|
294
|
-
# confidence](https://
|
313
|
+
# each word. By default, the service returns no word confidence scores. See [Word
|
314
|
+
# confidence](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_confidence).
|
295
315
|
# @param timestamps [Boolean] If `true`, the service returns time alignment for each word. By default, no
|
296
316
|
# timestamps are returned. See [Word
|
297
|
-
# timestamps](https://
|
317
|
+
# timestamps](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_timestamps).
|
298
318
|
# @param profanity_filter [Boolean] If `true`, the service filters profanity from all output except for keyword
|
299
319
|
# results by replacing inappropriate words with a series of asterisks. Set the
|
300
320
|
# parameter to `false` to return results with no censoring. Applies to US English
|
301
321
|
# transcription only. See [Profanity
|
302
|
-
# filtering](https://
|
322
|
+
# filtering](https://cloud.ibm.com/docs/services/speech-to-text/output.html#profanity_filter).
|
303
323
|
# @param smart_formatting [Boolean] If `true`, the service converts dates, times, series of digits and numbers, phone
|
304
324
|
# numbers, currency values, and internet addresses into more readable, conventional
|
305
325
|
# representations in the final transcript of a recognition request. For US English,
|
306
326
|
# the service also converts certain keyword strings to punctuation symbols. By
|
307
|
-
# default, no smart formatting
|
308
|
-
#
|
309
|
-
#
|
327
|
+
# default, the service performs no smart formatting.
|
328
|
+
#
|
329
|
+
# **Note:** Applies to US English, Japanese, and Spanish transcription only.
|
330
|
+
#
|
331
|
+
# See [Smart
|
332
|
+
# formatting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#smart_formatting).
|
310
333
|
# @param speaker_labels [Boolean] If `true`, the response includes labels that identify which words were spoken by
|
311
|
-
# which participants in a multi-person exchange. By default,
|
312
|
-
#
|
313
|
-
# be `true`, regardless of whether you specify `false` for the
|
334
|
+
# which participants in a multi-person exchange. By default, the service returns no
|
335
|
+
# speaker labels. Setting `speaker_labels` to `true` forces the `timestamps`
|
336
|
+
# parameter to be `true`, regardless of whether you specify `false` for the
|
337
|
+
# parameter.
|
314
338
|
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
339
|
+
# **Note:** Applies to US English, Japanese, and Spanish transcription only. To
|
340
|
+
# determine whether a language model supports speaker labels, you can also use the
|
341
|
+
# **Get a model** method and check that the attribute `speaker_labels` is set to
|
342
|
+
# `true`.
|
343
|
+
#
|
344
|
+
# See [Speaker
|
345
|
+
# labels](https://cloud.ibm.com/docs/services/speech-to-text/output.html#speaker_labels).
|
318
346
|
# @param customization_id [String] **Deprecated.** Use the `language_customization_id` parameter to specify the
|
319
347
|
# customization ID (GUID) of a custom language model that is to be used with the
|
320
348
|
# recognition request. Do not specify both parameters with a request.
|
349
|
+
# @param grammar_name [String] The name of a grammar that is to be used with the recognition request. If you
|
350
|
+
# specify a grammar, you must also use the `language_customization_id` parameter to
|
351
|
+
# specify the name of the custom language model for which the grammar is defined.
|
352
|
+
# The service recognizes only strings that are recognized by the specified grammar;
|
353
|
+
# it does not recognize other custom words from the model's words resource. See
|
354
|
+
# [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/output.html).
|
355
|
+
# @param redaction [Boolean] If `true`, the service redacts, or masks, numeric data from final transcripts. The
|
356
|
+
# feature redacts any number that has three or more consecutive digits by replacing
|
357
|
+
# each digit with an `X` character. It is intended to redact sensitive numeric data,
|
358
|
+
# such as credit card numbers. By default, the service performs no redaction.
|
359
|
+
#
|
360
|
+
# When you enable redaction, the service automatically enables smart formatting,
|
361
|
+
# regardless of whether you explicitly disable that feature. To ensure maximum
|
362
|
+
# security, the service also disables keyword spotting (ignores the `keywords` and
|
363
|
+
# `keywords_threshold` parameters) and returns only a single final transcript
|
364
|
+
# (forces the `max_alternatives` parameter to be `1`).
|
365
|
+
#
|
366
|
+
# **Note:** Applies to US English, Japanese, and Korean transcription only.
|
367
|
+
#
|
368
|
+
# See [Numeric
|
369
|
+
# redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
|
321
370
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
322
|
-
def recognize(audio:, content_type: nil, 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)
|
371
|
+
def recognize(audio:, content_type: nil, 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)
|
323
372
|
raise ArgumentError.new("audio must be provided") if audio.nil?
|
324
373
|
|
325
374
|
headers = {
|
@@ -342,7 +391,9 @@ module IBMWatson
|
|
342
391
|
"profanity_filter" => profanity_filter,
|
343
392
|
"smart_formatting" => smart_formatting,
|
344
393
|
"speaker_labels" => speaker_labels,
|
345
|
-
"customization_id" => customization_id
|
394
|
+
"customization_id" => customization_id,
|
395
|
+
"grammar_name" => grammar_name,
|
396
|
+
"redaction" => redaction
|
346
397
|
}
|
347
398
|
|
348
399
|
data = audio
|
@@ -368,9 +419,9 @@ module IBMWatson
|
|
368
419
|
# @param audio [IO] Audio to transcribe in the format specified by the `Content-Type` header.
|
369
420
|
# @param chunk_data [Boolean] If true, then the WebSocketClient will expect to receive data in chunks rather than as a single audio file
|
370
421
|
# @param model [String] The identifier of the model to be used for the recognition request.
|
371
|
-
# @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.
|
372
422
|
# @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.
|
373
423
|
# @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.
|
424
|
+
# @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.
|
374
425
|
# @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.
|
375
426
|
# @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).
|
376
427
|
# @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.
|
@@ -384,6 +435,27 @@ module IBMWatson
|
|
384
435
|
# @param profanity_filter [Boolean] If `true` (the default), filters profanity from all output except for keyword results by replacing inappropriate words with a series of asterisks. Set the parameter to `false` to return results with no censoring. Applies to US English transcription only.
|
385
436
|
# @param smart_formatting [Boolean] If `true`, converts dates, times, series of digits and numbers, phone numbers, currency values, and Internet addresses into more readable, conventional representations in the final transcript of a recognition request. If `false` (the default), no formatting is performed. Applies to US English transcription only.
|
386
437
|
# @param speaker_labels [Boolean] Indicates whether labels that identify which words were spoken by which participants in a multi-person exchange are to be included in the response. The default is `false`; no speaker labels are returned. Setting `speaker_labels` to `true` forces the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter. To determine whether a language model supports speaker labels, use the `GET /v1/models` method and check that the attribute `speaker_labels` is set to `true`. You can also refer to [Speaker labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
|
438
|
+
# @param grammar_name [String] The name of a grammar that is to be used with the recognition request. If you
|
439
|
+
# specify a grammar, you must also use the `language_customization_id` parameter to
|
440
|
+
# specify the name of the custom language model for which the grammar is defined.
|
441
|
+
# The service recognizes only strings that are recognized by the specified grammar;
|
442
|
+
# it does not recognize other custom words from the model's words resource. See
|
443
|
+
# [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/output.html).
|
444
|
+
# @param redaction [Boolean] If `true`, the service redacts, or masks, numeric data from final transcripts. The
|
445
|
+
# feature redacts any number that has three or more consecutive digits by replacing
|
446
|
+
# each digit with an `X` character. It is intended to redact sensitive numeric data,
|
447
|
+
# such as credit card numbers. By default, the service performs no redaction.
|
448
|
+
#
|
449
|
+
# When you enable redaction, the service automatically enables smart formatting,
|
450
|
+
# regardless of whether you explicitly disable that feature. To ensure maximum
|
451
|
+
# security, the service also disables keyword spotting (ignores the `keywords` and
|
452
|
+
# `keywords_threshold` parameters) and returns only a single final transcript
|
453
|
+
# (forces the `max_alternatives` parameter to be `1`).
|
454
|
+
#
|
455
|
+
# **Note:** Applies to US English, Japanese, and Korean transcription only.
|
456
|
+
#
|
457
|
+
# See [Numeric
|
458
|
+
# redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
|
387
459
|
# @return [WebSocketClient] Returns a new WebSocketClient object
|
388
460
|
def recognize_using_websocket(
|
389
461
|
content_type: nil,
|
@@ -406,7 +478,9 @@ module IBMWatson
|
|
406
478
|
timestamps: nil,
|
407
479
|
profanity_filter: nil,
|
408
480
|
smart_formatting: nil,
|
409
|
-
speaker_labels: nil
|
481
|
+
speaker_labels: nil,
|
482
|
+
grammar_name: nil,
|
483
|
+
redaction: nil
|
410
484
|
)
|
411
485
|
raise ArgumentError("Audio must be provided") if audio.nil? && !chunk_data
|
412
486
|
raise ArgumentError("Recognize callback must be provided") if recognize_callback.nil?
|
@@ -428,7 +502,9 @@ module IBMWatson
|
|
428
502
|
"langauge_customization_id" => language_customization_id,
|
429
503
|
"acoustic_customization_id" => acoustic_customization_id,
|
430
504
|
"customization_weight" => customization_weight,
|
431
|
-
"base_model_version" => base_model_version
|
505
|
+
"base_model_version" => base_model_version,
|
506
|
+
"grammar_name" => grammar_name,
|
507
|
+
"redaction" => redaction
|
432
508
|
}
|
433
509
|
params.delete_if { |_, v| v.nil? }
|
434
510
|
url += "/v1/recognize?" + HTTP::URI.form_encode(params)
|
@@ -539,7 +615,7 @@ module IBMWatson
|
|
539
615
|
# a one-hour span of time.
|
540
616
|
#
|
541
617
|
# **See also:** [Registering a callback
|
542
|
-
# URL](https://
|
618
|
+
# URL](https://cloud.ibm.com/docs/services/speech-to-text/async.html#register).
|
543
619
|
# @param callback_url [String] An HTTP or HTTPS URL to which callback notifications are to be sent. To be
|
544
620
|
# white-listed, the URL must successfully echo the challenge string during URL
|
545
621
|
# verification. During verification, the client can also check the signature that
|
@@ -582,7 +658,7 @@ module IBMWatson
|
|
582
658
|
# URL can no longer be used with asynchronous recognition requests.
|
583
659
|
#
|
584
660
|
# **See also:** [Unregistering a callback
|
585
|
-
# URL](https://
|
661
|
+
# URL](https://cloud.ibm.com/docs/services/speech-to-text/async.html#unregister).
|
586
662
|
# @param callback_url [String] The callback URL that is to be unregistered.
|
587
663
|
# @return [nil]
|
588
664
|
def unregister_callback(callback_url:)
|
@@ -608,12 +684,12 @@ module IBMWatson
|
|
608
684
|
end
|
609
685
|
|
610
686
|
##
|
611
|
-
# @!method create_job(audio:, content_type: nil, 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)
|
687
|
+
# @!method create_job(audio:, content_type: nil, 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)
|
612
688
|
# Create a job.
|
613
689
|
# Creates a job for a new asynchronous recognition request. The job is owned by the
|
614
|
-
#
|
615
|
-
# results of a job depends on the parameters you include with the job
|
616
|
-
# request:
|
690
|
+
# instance of the service whose credentials are used to create it. How you learn the
|
691
|
+
# status and results of a job depends on the parameters you include with the job
|
692
|
+
# creation request:
|
617
693
|
# * By callback notification: Include the `callback_url` parameter to specify a URL
|
618
694
|
# to which the service is to send callback notifications when the status of the job
|
619
695
|
# changes. Optionally, you can also include the `events` and `user_token` parameters
|
@@ -646,7 +722,8 @@ module IBMWatson
|
|
646
722
|
# mono during transcoding. The method returns only final results; to enable interim
|
647
723
|
# results, use the WebSocket API.
|
648
724
|
#
|
649
|
-
# **See also:** [Creating a
|
725
|
+
# **See also:** [Creating a
|
726
|
+
# job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#create).
|
650
727
|
#
|
651
728
|
# ### Streaming mode
|
652
729
|
#
|
@@ -659,8 +736,11 @@ module IBMWatson
|
|
659
736
|
# `inactivity_timeout` parameter to change the default of 30 seconds.
|
660
737
|
#
|
661
738
|
# **See also:**
|
662
|
-
# * [Audio
|
663
|
-
#
|
739
|
+
# * [Audio
|
740
|
+
# transmission](https://cloud.ibm.com/docs/services/speech-to-text/input.html#transmission)
|
741
|
+
# *
|
742
|
+
# [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts)
|
743
|
+
#
|
664
744
|
#
|
665
745
|
# ### Audio formats (content types)
|
666
746
|
#
|
@@ -676,6 +756,7 @@ module IBMWatson
|
|
676
756
|
# can optionally include the number of channels and the endianness of the audio.
|
677
757
|
# * `audio/basic` (**Required.** Use only with narrowband models.)
|
678
758
|
# * `audio/flac`
|
759
|
+
# * `audio/g729` (Use only with narrowband models.)
|
679
760
|
# * `audio/l16` (**Required.** Specify the sampling rate (`rate`) and optionally the
|
680
761
|
# number of channels (`channels`) and endianness (`endianness`) of the audio.)
|
681
762
|
# * `audio/mp3`
|
@@ -689,11 +770,21 @@ module IBMWatson
|
|
689
770
|
# * `audio/webm;codecs=opus`
|
690
771
|
# * `audio/webm;codecs=vorbis`
|
691
772
|
#
|
692
|
-
#
|
773
|
+
# The sampling rate of the audio must match the sampling rate of the model for the
|
774
|
+
# recognition request: for broadband models, at least 16 kHz; for narrowband models,
|
775
|
+
# at least 8 kHz. If the sampling rate of the audio is higher than the minimum
|
776
|
+
# required rate, the service down-samples the audio to the appropriate rate. If the
|
777
|
+
# sampling rate of the audio is lower than the minimum required rate, the request
|
778
|
+
# fails.
|
779
|
+
#
|
780
|
+
# **See also:** [Audio
|
781
|
+
# formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
|
693
782
|
# @param audio [String] The audio to transcribe.
|
694
783
|
# @param content_type [String] The format (MIME type) of the audio. For more information about specifying an
|
695
784
|
# audio format, see **Audio formats (content types)** in the method description.
|
696
|
-
# @param model [String] The identifier of the model that is to be used for the recognition request.
|
785
|
+
# @param model [String] The identifier of the model that is to be used for the recognition request. See
|
786
|
+
# [Languages and
|
787
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/models.html).
|
697
788
|
# @param callback_url [String] A URL to which callback notifications are to be sent. The URL must already be
|
698
789
|
# successfully white-listed by using the **Register a callback** method. You can
|
699
790
|
# include the same callback URL with any number of job creation requests. Omit the
|
@@ -731,24 +822,24 @@ module IBMWatson
|
|
731
822
|
# @param language_customization_id [String] The customization ID (GUID) of a custom language model that is to be used with the
|
732
823
|
# recognition request. The base model of the specified custom language model must
|
733
824
|
# match the model specified with the `model` parameter. You must make the request
|
734
|
-
# with
|
735
|
-
#
|
736
|
-
# models](https://
|
825
|
+
# with credentials for the instance of the service that owns the custom model. By
|
826
|
+
# default, no custom language model is used. See [Custom
|
827
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom).
|
737
828
|
#
|
738
829
|
# **Note:** Use this parameter instead of the deprecated `customization_id`
|
739
830
|
# parameter.
|
740
831
|
# @param acoustic_customization_id [String] The customization ID (GUID) of a custom acoustic model that is to be used with the
|
741
832
|
# recognition request. The base model of the specified custom acoustic model must
|
742
833
|
# match the model specified with the `model` parameter. You must make the request
|
743
|
-
# with
|
744
|
-
#
|
745
|
-
# models](https://
|
834
|
+
# with credentials for the instance of the service that owns the custom model. By
|
835
|
+
# default, no custom acoustic model is used. See [Custom
|
836
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom).
|
746
837
|
# @param base_model_version [String] The version of the specified base model that is to be used with recognition
|
747
838
|
# request. Multiple versions of a base model can exist when a model is updated for
|
748
839
|
# internal improvements. The parameter is intended primarily for use with custom
|
749
840
|
# models that have been upgraded for a new base model. The default value depends on
|
750
841
|
# whether the parameter is used with or without a custom model. See [Base model
|
751
|
-
# version](https://
|
842
|
+
# version](https://cloud.ibm.com/docs/services/speech-to-text/input.html#version).
|
752
843
|
# @param customization_weight [Float] If you specify the customization ID (GUID) of a custom language model with the
|
753
844
|
# recognition request, the customization weight tells the service how much weight to
|
754
845
|
# give to words from the custom language model compared to those from the base model
|
@@ -765,64 +856,94 @@ module IBMWatson
|
|
765
856
|
# custom model's domain, but it can negatively affect performance on non-domain
|
766
857
|
# phrases.
|
767
858
|
#
|
768
|
-
# See [Custom
|
859
|
+
# See [Custom
|
860
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/input.html#custom).
|
769
861
|
# @param inactivity_timeout [Fixnum] The time in seconds after which, if only silence (no speech) is detected in
|
770
862
|
# submitted audio, the connection is closed with a 400 error. The parameter is
|
771
863
|
# useful for stopping audio submission from a live microphone when a user simply
|
772
864
|
# walks away. Use `-1` for infinity. See
|
773
|
-
# [Timeouts](https://
|
865
|
+
# [Timeouts](https://cloud.ibm.com/docs/services/speech-to-text/input.html#timeouts).
|
774
866
|
# @param keywords [Array[String]] An array of keyword strings to spot in the audio. Each keyword string can include
|
775
867
|
# one or more string tokens. Keywords are spotted only in the final results, not in
|
776
868
|
# interim hypotheses. If you specify any keywords, you must also specify a keywords
|
777
869
|
# threshold. You can spot a maximum of 1000 keywords. Omit the parameter or specify
|
778
870
|
# an empty array if you do not need to spot keywords. See [Keyword
|
779
|
-
# spotting](https://
|
871
|
+
# spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
|
780
872
|
# @param keywords_threshold [Float] A confidence value that is the lower bound for spotting a keyword. A word is
|
781
873
|
# considered to match a keyword if its confidence is greater than or equal to the
|
782
|
-
# threshold. Specify a probability between 0.0 and 1.0.
|
783
|
-
#
|
784
|
-
#
|
785
|
-
# spotting](https://
|
874
|
+
# threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold,
|
875
|
+
# you must also specify one or more keywords. The service performs no keyword
|
876
|
+
# spotting if you omit either parameter. See [Keyword
|
877
|
+
# spotting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#keyword_spotting).
|
786
878
|
# @param max_alternatives [Fixnum] The maximum number of alternative transcripts that the service is to return. By
|
787
|
-
# default, a single
|
788
|
-
# alternatives](https://
|
879
|
+
# default, the service returns a single transcript. See [Maximum
|
880
|
+
# alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#max_alternatives).
|
789
881
|
# @param word_alternatives_threshold [Float] A confidence value that is the lower bound for identifying a hypothesis as a
|
790
882
|
# possible word alternative (also known as \"Confusion Networks\"). An alternative
|
791
883
|
# word is considered if its confidence is greater than or equal to the threshold.
|
792
|
-
# Specify a probability between 0.0 and 1.0.
|
793
|
-
#
|
794
|
-
# alternatives](https://
|
884
|
+
# Specify a probability between 0.0 and 1.0. By default, the service computes no
|
885
|
+
# alternative words. See [Word
|
886
|
+
# alternatives](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_alternatives).
|
795
887
|
# @param word_confidence [Boolean] If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for
|
796
|
-
# each word. By default, no word confidence
|
797
|
-
# confidence](https://
|
888
|
+
# each word. By default, the service returns no word confidence scores. See [Word
|
889
|
+
# confidence](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_confidence).
|
798
890
|
# @param timestamps [Boolean] If `true`, the service returns time alignment for each word. By default, no
|
799
891
|
# timestamps are returned. See [Word
|
800
|
-
# timestamps](https://
|
892
|
+
# timestamps](https://cloud.ibm.com/docs/services/speech-to-text/output.html#word_timestamps).
|
801
893
|
# @param profanity_filter [Boolean] If `true`, the service filters profanity from all output except for keyword
|
802
894
|
# results by replacing inappropriate words with a series of asterisks. Set the
|
803
895
|
# parameter to `false` to return results with no censoring. Applies to US English
|
804
896
|
# transcription only. See [Profanity
|
805
|
-
# filtering](https://
|
897
|
+
# filtering](https://cloud.ibm.com/docs/services/speech-to-text/output.html#profanity_filter).
|
806
898
|
# @param smart_formatting [Boolean] If `true`, the service converts dates, times, series of digits and numbers, phone
|
807
899
|
# numbers, currency values, and internet addresses into more readable, conventional
|
808
900
|
# representations in the final transcript of a recognition request. For US English,
|
809
901
|
# the service also converts certain keyword strings to punctuation symbols. By
|
810
|
-
# default, no smart formatting
|
811
|
-
#
|
812
|
-
#
|
902
|
+
# default, the service performs no smart formatting.
|
903
|
+
#
|
904
|
+
# **Note:** Applies to US English, Japanese, and Spanish transcription only.
|
905
|
+
#
|
906
|
+
# See [Smart
|
907
|
+
# formatting](https://cloud.ibm.com/docs/services/speech-to-text/output.html#smart_formatting).
|
813
908
|
# @param speaker_labels [Boolean] If `true`, the response includes labels that identify which words were spoken by
|
814
|
-
# which participants in a multi-person exchange. By default,
|
815
|
-
#
|
816
|
-
# be `true`, regardless of whether you specify `false` for the
|
909
|
+
# which participants in a multi-person exchange. By default, the service returns no
|
910
|
+
# speaker labels. Setting `speaker_labels` to `true` forces the `timestamps`
|
911
|
+
# parameter to be `true`, regardless of whether you specify `false` for the
|
912
|
+
# parameter.
|
913
|
+
#
|
914
|
+
# **Note:** Applies to US English, Japanese, and Spanish transcription only. To
|
915
|
+
# determine whether a language model supports speaker labels, you can also use the
|
916
|
+
# **Get a model** method and check that the attribute `speaker_labels` is set to
|
917
|
+
# `true`.
|
817
918
|
#
|
818
|
-
#
|
819
|
-
#
|
820
|
-
# [Speaker labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
|
919
|
+
# See [Speaker
|
920
|
+
# labels](https://cloud.ibm.com/docs/services/speech-to-text/output.html#speaker_labels).
|
821
921
|
# @param customization_id [String] **Deprecated.** Use the `language_customization_id` parameter to specify the
|
822
922
|
# customization ID (GUID) of a custom language model that is to be used with the
|
823
923
|
# recognition request. Do not specify both parameters with a request.
|
924
|
+
# @param grammar_name [String] The name of a grammar that is to be used with the recognition request. If you
|
925
|
+
# specify a grammar, you must also use the `language_customization_id` parameter to
|
926
|
+
# specify the name of the custom language model for which the grammar is defined.
|
927
|
+
# The service recognizes only strings that are recognized by the specified grammar;
|
928
|
+
# it does not recognize other custom words from the model's words resource. See
|
929
|
+
# [Grammars](https://cloud.ibm.com/docs/services/speech-to-text/output.html).
|
930
|
+
# @param redaction [Boolean] If `true`, the service redacts, or masks, numeric data from final transcripts. The
|
931
|
+
# feature redacts any number that has three or more consecutive digits by replacing
|
932
|
+
# each digit with an `X` character. It is intended to redact sensitive numeric data,
|
933
|
+
# such as credit card numbers. By default, the service performs no redaction.
|
934
|
+
#
|
935
|
+
# When you enable redaction, the service automatically enables smart formatting,
|
936
|
+
# regardless of whether you explicitly disable that feature. To ensure maximum
|
937
|
+
# security, the service also disables keyword spotting (ignores the `keywords` and
|
938
|
+
# `keywords_threshold` parameters) and returns only a single final transcript
|
939
|
+
# (forces the `max_alternatives` parameter to be `1`).
|
940
|
+
#
|
941
|
+
# **Note:** Applies to US English, Japanese, and Korean transcription only.
|
942
|
+
#
|
943
|
+
# See [Numeric
|
944
|
+
# redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
|
824
945
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
825
|
-
def create_job(audio:, content_type: nil, 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)
|
946
|
+
def create_job(audio:, content_type: nil, 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)
|
826
947
|
raise ArgumentError.new("audio must be provided") if audio.nil?
|
827
948
|
|
828
949
|
headers = {
|
@@ -849,7 +970,9 @@ module IBMWatson
|
|
849
970
|
"profanity_filter" => profanity_filter,
|
850
971
|
"smart_formatting" => smart_formatting,
|
851
972
|
"speaker_labels" => speaker_labels,
|
852
|
-
"customization_id" => customization_id
|
973
|
+
"customization_id" => customization_id,
|
974
|
+
"grammar_name" => grammar_name,
|
975
|
+
"redaction" => redaction
|
853
976
|
}
|
854
977
|
|
855
978
|
data = audio
|
@@ -871,16 +994,16 @@ module IBMWatson
|
|
871
994
|
# @!method check_jobs
|
872
995
|
# Check jobs.
|
873
996
|
# Returns the ID and status of the latest 100 outstanding jobs associated with the
|
874
|
-
#
|
875
|
-
#
|
876
|
-
#
|
877
|
-
#
|
878
|
-
#
|
879
|
-
#
|
880
|
-
#
|
997
|
+
# credentials with which it is called. The method also returns the creation and
|
998
|
+
# update times of each job, and, if a job was created with a callback URL and a user
|
999
|
+
# token, the user token for the job. To obtain the results for a job whose status is
|
1000
|
+
# `completed` or not one of the latest 100 outstanding jobs, use the **Check a job**
|
1001
|
+
# method. A job and its results remain available until you delete them with the
|
1002
|
+
# **Delete a job** method or until the job's time to live expires, whichever comes
|
1003
|
+
# first.
|
881
1004
|
#
|
882
1005
|
# **See also:** [Checking the status of the latest
|
883
|
-
# jobs](https://
|
1006
|
+
# jobs](https://cloud.ibm.com/docs/services/speech-to-text/async.html#jobs).
|
884
1007
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
885
1008
|
def check_jobs
|
886
1009
|
headers = {
|
@@ -902,18 +1025,21 @@ module IBMWatson
|
|
902
1025
|
# Check a job.
|
903
1026
|
# Returns information about the specified job. The response always includes the
|
904
1027
|
# status of the job and its creation and update times. If the status is `completed`,
|
905
|
-
# the response includes the results of the recognition request. You must
|
906
|
-
#
|
1028
|
+
# the response includes the results of the recognition request. You must use
|
1029
|
+
# credentials for the instance of the service that owns a job to list information
|
1030
|
+
# about it.
|
907
1031
|
#
|
908
1032
|
# You can use the method to retrieve the results of any job, regardless of whether
|
909
1033
|
# it was submitted with a callback URL and the `recognitions.completed_with_results`
|
910
1034
|
# event, and you can retrieve the results multiple times for as long as they remain
|
911
1035
|
# available. Use the **Check jobs** method to request information about the most
|
912
|
-
# recent jobs associated with the
|
1036
|
+
# recent jobs associated with the calling credentials.
|
913
1037
|
#
|
914
1038
|
# **See also:** [Checking the status and retrieving the results of a
|
915
|
-
# job](https://
|
916
|
-
# @param id [String] The identifier of the asynchronous job that is to be used for the request.
|
1039
|
+
# job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#job).
|
1040
|
+
# @param id [String] The identifier of the asynchronous job that is to be used for the request. You
|
1041
|
+
# must make the request with credentials for the instance of the service that owns
|
1042
|
+
# the job.
|
917
1043
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
918
1044
|
def check_job(id:)
|
919
1045
|
raise ArgumentError.new("id must be provided") if id.nil?
|
@@ -938,11 +1064,14 @@ module IBMWatson
|
|
938
1064
|
# Deletes the specified job. You cannot delete a job that the service is actively
|
939
1065
|
# processing. Once you delete a job, its results are no longer available. The
|
940
1066
|
# service automatically deletes a job and its results when the time to live for the
|
941
|
-
# results expires. You must
|
942
|
-
#
|
943
|
-
#
|
944
|
-
# **See also:** [Deleting a
|
945
|
-
#
|
1067
|
+
# results expires. You must use credentials for the instance of the service that
|
1068
|
+
# owns a job to delete it.
|
1069
|
+
#
|
1070
|
+
# **See also:** [Deleting a
|
1071
|
+
# job](https://cloud.ibm.com/docs/services/speech-to-text/async.html#delete).
|
1072
|
+
# @param id [String] The identifier of the asynchronous job that is to be used for the request. You
|
1073
|
+
# must make the request with credentials for the instance of the service that owns
|
1074
|
+
# the job.
|
946
1075
|
# @return [nil]
|
947
1076
|
def delete_job(id:)
|
948
1077
|
raise ArgumentError.new("id must be provided") if id.nil?
|
@@ -973,7 +1102,7 @@ module IBMWatson
|
|
973
1102
|
# it.
|
974
1103
|
#
|
975
1104
|
# **See also:** [Create a custom language
|
976
|
-
# model](https://
|
1105
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#createModel).
|
977
1106
|
# @param name [String] A user-defined name for the new custom language model. Use a name that is unique
|
978
1107
|
# among all custom language models that you own. Use a localized name that matches
|
979
1108
|
# the language of the custom model. Use a name that describes the domain of the
|
@@ -985,7 +1114,7 @@ module IBMWatson
|
|
985
1114
|
# To determine whether a base model supports language model customization, use the
|
986
1115
|
# **Get a model** method and check that the attribute `custom_language_model` is set
|
987
1116
|
# to `true`. You can also refer to [Language support for
|
988
|
-
# customization](https://
|
1117
|
+
# customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
|
989
1118
|
# @param dialect [String] The dialect of the specified language that is to be used with the custom language
|
990
1119
|
# model. The parameter is meaningful only for Spanish models, for which the service
|
991
1120
|
# creates a custom language model that is suited for speech in one of the following
|
@@ -1037,10 +1166,10 @@ module IBMWatson
|
|
1037
1166
|
# a model to list information about it.
|
1038
1167
|
#
|
1039
1168
|
# **See also:** [Listing custom language
|
1040
|
-
# models](https://
|
1169
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#listModels).
|
1041
1170
|
# @param language [String] The identifier of the language for which custom language or custom acoustic models
|
1042
1171
|
# are to be returned (for example, `en-US`). Omit the parameter to see all custom
|
1043
|
-
# language or custom acoustic models owned by the requesting
|
1172
|
+
# language or custom acoustic models that are owned by the requesting credentials.
|
1044
1173
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1045
1174
|
def list_language_models(language: nil)
|
1046
1175
|
headers = {
|
@@ -1069,10 +1198,10 @@ module IBMWatson
|
|
1069
1198
|
# for the instance of the service that owns a model to list information about it.
|
1070
1199
|
#
|
1071
1200
|
# **See also:** [Listing custom language
|
1072
|
-
# models](https://
|
1201
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#listModels).
|
1073
1202
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1074
|
-
# the request. You must make the request with
|
1075
|
-
#
|
1203
|
+
# the request. You must make the request with credentials for the instance of the
|
1204
|
+
# service that owns the custom model.
|
1076
1205
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1077
1206
|
def get_language_model(customization_id:)
|
1078
1207
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1095,15 +1224,15 @@ module IBMWatson
|
|
1095
1224
|
# @!method delete_language_model(customization_id:)
|
1096
1225
|
# Delete a custom language model.
|
1097
1226
|
# Deletes an existing custom language model. The custom model cannot be deleted if
|
1098
|
-
# another request, such as adding a corpus to the model, is currently
|
1099
|
-
# processed. You must use credentials for the instance of the service that
|
1100
|
-
# model to delete it.
|
1227
|
+
# another request, such as adding a corpus or grammar to the model, is currently
|
1228
|
+
# being processed. You must use credentials for the instance of the service that
|
1229
|
+
# owns a model to delete it.
|
1101
1230
|
#
|
1102
1231
|
# **See also:** [Deleting a custom language
|
1103
|
-
# model](https://
|
1232
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#deleteModel).
|
1104
1233
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1105
|
-
# the request. You must make the request with
|
1106
|
-
#
|
1234
|
+
# the request. You must make the request with credentials for the instance of the
|
1235
|
+
# service that owns the custom model.
|
1107
1236
|
# @return [nil]
|
1108
1237
|
def delete_language_model(customization_id:)
|
1109
1238
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1125,13 +1254,13 @@ module IBMWatson
|
|
1125
1254
|
##
|
1126
1255
|
# @!method train_language_model(customization_id:, word_type_to_add: nil, customization_weight: nil)
|
1127
1256
|
# Train a custom language model.
|
1128
|
-
# Initiates the training of a custom language model with new
|
1129
|
-
#
|
1130
|
-
# language model, use this method to begin the actual
|
1131
|
-
# latest data. You can specify whether the custom
|
1132
|
-
# with all words from its words resource or only
|
1133
|
-
# modified by the user. You must use
|
1134
|
-
# that owns a model to train it.
|
1257
|
+
# Initiates the training of a custom language model with new resources such as
|
1258
|
+
# corpora, grammars, and custom words. After adding, modifying, or deleting
|
1259
|
+
# resources for a custom language model, use this method to begin the actual
|
1260
|
+
# training of the model on the latest data. You can specify whether the custom
|
1261
|
+
# language model is to be trained with all words from its words resource or only
|
1262
|
+
# with words that were added or modified by the user directly. You must use
|
1263
|
+
# credentials for the instance of the service that owns a model to train it.
|
1135
1264
|
#
|
1136
1265
|
# The training method is asynchronous. It can take on the order of minutes to
|
1137
1266
|
# complete depending on the amount of data on which the service is being trained and
|
@@ -1142,27 +1271,29 @@ module IBMWatson
|
|
1142
1271
|
# model** method to poll the model's status. Use a loop to check the status every 10
|
1143
1272
|
# seconds. The method returns a `LanguageModel` object that includes `status` and
|
1144
1273
|
# `progress` fields. A status of `available` means that the custom model is trained
|
1145
|
-
# and ready to use. The service cannot accept subsequent training requests
|
1146
|
-
# requests to add new
|
1274
|
+
# and ready to use. The service cannot accept subsequent training requests or
|
1275
|
+
# requests to add new resources until the existing request completes.
|
1147
1276
|
#
|
1148
1277
|
# Training can fail to start for the following reasons:
|
1149
1278
|
# * The service is currently handling another request for the custom model, such as
|
1150
|
-
# another training request or a request to add a corpus or
|
1151
|
-
# * No training data
|
1279
|
+
# another training request or a request to add a corpus or grammar to the model.
|
1280
|
+
# * No training data have been added to the custom model.
|
1152
1281
|
# * One or more words that were added to the custom model have invalid sounds-like
|
1153
1282
|
# pronunciations that you must fix.
|
1154
1283
|
#
|
1155
1284
|
# **See also:** [Train the custom language
|
1156
|
-
# model](https://
|
1285
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#trainModel).
|
1157
1286
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1158
|
-
# the request. You must make the request with
|
1159
|
-
#
|
1287
|
+
# the request. You must make the request with credentials for the instance of the
|
1288
|
+
# service that owns the custom model.
|
1160
1289
|
# @param word_type_to_add [String] The type of words from the custom language model's words resource on which to
|
1161
1290
|
# train the model:
|
1162
1291
|
# * `all` (the default) trains the model on all new words, regardless of whether
|
1163
|
-
# they were extracted from corpora or were added or modified by the
|
1292
|
+
# they were extracted from corpora or grammars or were added or modified by the
|
1293
|
+
# user.
|
1164
1294
|
# * `user` trains the model only on new words that were added or modified by the
|
1165
|
-
# user
|
1295
|
+
# user directly. The model is not trained on new words extracted from corpora or
|
1296
|
+
# grammars.
|
1166
1297
|
# @param customization_weight [Float] Specifies a customization weight for the custom language model. The customization
|
1167
1298
|
# weight tells the service how much weight to give to words from the custom language
|
1168
1299
|
# model compared to those from the base model for speech recognition. Specify a
|
@@ -1204,17 +1335,18 @@ module IBMWatson
|
|
1204
1335
|
##
|
1205
1336
|
# @!method reset_language_model(customization_id:)
|
1206
1337
|
# Reset a custom language model.
|
1207
|
-
# Resets a custom language model by removing all corpora and words from
|
1208
|
-
# Resetting a custom language model initializes the model to its state
|
1209
|
-
# first created. Metadata such as the name and language of the model are
|
1210
|
-
# but the model's words resource is removed and must be re-created. You
|
1211
|
-
# credentials for the instance of the service that owns a model to reset
|
1338
|
+
# Resets a custom language model by removing all corpora, grammars, and words from
|
1339
|
+
# the model. Resetting a custom language model initializes the model to its state
|
1340
|
+
# when it was first created. Metadata such as the name and language of the model are
|
1341
|
+
# preserved, but the model's words resource is removed and must be re-created. You
|
1342
|
+
# must use credentials for the instance of the service that owns a model to reset
|
1343
|
+
# it.
|
1212
1344
|
#
|
1213
1345
|
# **See also:** [Resetting a custom language
|
1214
|
-
# model](https://
|
1346
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-models.html#resetModel).
|
1215
1347
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1216
|
-
# the request. You must make the request with
|
1217
|
-
#
|
1348
|
+
# the request. You must make the request with credentials for the instance of the
|
1349
|
+
# service that owns the custom model.
|
1218
1350
|
# @return [nil]
|
1219
1351
|
def reset_language_model(customization_id:)
|
1220
1352
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1253,10 +1385,10 @@ module IBMWatson
|
|
1253
1385
|
# subsequent requests for the model until the upgrade completes.
|
1254
1386
|
#
|
1255
1387
|
# **See also:** [Upgrading a custom language
|
1256
|
-
# model](https://
|
1388
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeLanguage).
|
1257
1389
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1258
|
-
# the request. You must make the request with
|
1259
|
-
#
|
1390
|
+
# the request. You must make the request with credentials for the instance of the
|
1391
|
+
# service that owns the custom model.
|
1260
1392
|
# @return [nil]
|
1261
1393
|
def upgrade_language_model(customization_id:)
|
1262
1394
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1287,10 +1419,10 @@ module IBMWatson
|
|
1287
1419
|
# that owns a model to list its corpora.
|
1288
1420
|
#
|
1289
1421
|
# **See also:** [Listing corpora for a custom language
|
1290
|
-
# model](https://
|
1422
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#listCorpora).
|
1291
1423
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1292
|
-
# the request. You must make the request with
|
1293
|
-
#
|
1424
|
+
# the request. You must make the request with credentials for the instance of the
|
1425
|
+
# service that owns the custom model.
|
1294
1426
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1295
1427
|
def list_corpora(customization_id:)
|
1296
1428
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1328,43 +1460,45 @@ module IBMWatson
|
|
1328
1460
|
# extracts new words that it finds. This can take on the order of a minute or two to
|
1329
1461
|
# complete depending on the total number of words and the number of new words in the
|
1330
1462
|
# corpus, as well as the current load on the service. You cannot submit requests to
|
1331
|
-
# add additional
|
1332
|
-
#
|
1333
|
-
#
|
1463
|
+
# add additional resources to the custom model or to train the model until the
|
1464
|
+
# service's analysis of the corpus for the current request completes. Use the **List
|
1465
|
+
# a corpus** method to check the status of the analysis.
|
1334
1466
|
#
|
1335
|
-
# The service auto-populates the model's words resource with
|
1336
|
-
# found in its base vocabulary
|
1337
|
-
# words. You can use the **List custom words** method to
|
1338
|
-
#
|
1339
|
-
# needed.
|
1467
|
+
# The service auto-populates the model's words resource with words from the corpus
|
1468
|
+
# that are not found in its base vocabulary. These are referred to as
|
1469
|
+
# out-of-vocabulary (OOV) words. You can use the **List custom words** method to
|
1470
|
+
# examine the words resource. You can use other words method to eliminate typos and
|
1471
|
+
# modify how words are pronounced as needed.
|
1340
1472
|
#
|
1341
1473
|
# To add a corpus file that has the same name as an existing corpus, set the
|
1342
1474
|
# `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting
|
1343
1475
|
# an existing corpus causes the service to process the corpus text file and extract
|
1344
1476
|
# OOV words anew. Before doing so, it removes any OOV words associated with the
|
1345
1477
|
# existing corpus from the model's words resource unless they were also added by
|
1346
|
-
# another corpus or they have been modified in some way with the **Add
|
1347
|
-
# words** or **Add a custom word** method.
|
1478
|
+
# another corpus or grammar, or they have been modified in some way with the **Add
|
1479
|
+
# custom words** or **Add a custom word** method.
|
1348
1480
|
#
|
1349
1481
|
# The service limits the overall amount of data that you can add to a custom model
|
1350
|
-
# to a maximum of 10 million total words from all
|
1351
|
-
# add no more than 30 thousand custom (OOV) words to a model
|
1352
|
-
# that the service extracts from corpora and words that you add
|
1482
|
+
# to a maximum of 10 million total words from all sources combined. Also, you can
|
1483
|
+
# add no more than 30 thousand custom (OOV) words to a model. This includes words
|
1484
|
+
# that the service extracts from corpora and grammars, and words that you add
|
1485
|
+
# directly.
|
1353
1486
|
#
|
1354
1487
|
# **See also:**
|
1355
1488
|
# * [Working with
|
1356
|
-
# corpora](https://
|
1489
|
+
# corpora](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingCorpora)
|
1357
1490
|
# * [Add corpora to the custom language
|
1358
|
-
# model](https://
|
1491
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addCorpora).
|
1359
1492
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1360
|
-
# the request. You must make the request with
|
1361
|
-
#
|
1493
|
+
# the request. You must make the request with credentials for the instance of the
|
1494
|
+
# service that owns the custom model.
|
1362
1495
|
# @param corpus_name [String] The name of the new corpus for the custom language model. Use a localized name
|
1363
1496
|
# that matches the language of the custom model and reflects the contents of the
|
1364
1497
|
# corpus.
|
1365
1498
|
# * Include a maximum of 128 characters in the name.
|
1366
1499
|
# * Do not include spaces, slashes, or backslashes in the name.
|
1367
|
-
# * Do not use the name of
|
1500
|
+
# * Do not use the name of an existing corpus or grammar that is already defined for
|
1501
|
+
# the custom model.
|
1368
1502
|
# * Do not use the name `user`, which is reserved by the service to denote custom
|
1369
1503
|
# words that are added or modified by the user.
|
1370
1504
|
# @param corpus_file [File] A plain text file that contains the training data for the corpus. Encode the file
|
@@ -1374,7 +1508,8 @@ module IBMWatson
|
|
1374
1508
|
# Make sure that you know the character encoding of the file. You must use that
|
1375
1509
|
# encoding when working with the words in the custom language model. For more
|
1376
1510
|
# information, see [Character
|
1377
|
-
# encoding](https://
|
1511
|
+
# encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
|
1512
|
+
#
|
1378
1513
|
#
|
1379
1514
|
# With the `curl` command, use the `--data-binary` option to upload the file for the
|
1380
1515
|
# request.
|
@@ -1427,10 +1562,10 @@ module IBMWatson
|
|
1427
1562
|
# that owns a model to list its corpora.
|
1428
1563
|
#
|
1429
1564
|
# **See also:** [Listing corpora for a custom language
|
1430
|
-
# model](https://
|
1565
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#listCorpora).
|
1431
1566
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1432
|
-
# the request. You must make the request with
|
1433
|
-
#
|
1567
|
+
# the request. You must make the request with credentials for the instance of the
|
1568
|
+
# service that owns the custom model.
|
1434
1569
|
# @param corpus_name [String] The name of the corpus for the custom language model.
|
1435
1570
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1436
1571
|
def get_corpus(customization_id:, corpus_name:)
|
@@ -1456,18 +1591,19 @@ module IBMWatson
|
|
1456
1591
|
# @!method delete_corpus(customization_id:, corpus_name:)
|
1457
1592
|
# Delete a corpus.
|
1458
1593
|
# Deletes an existing corpus from a custom language model. The service removes any
|
1459
|
-
# out-of-vocabulary (OOV) words associated with the corpus from the custom
|
1460
|
-
# words resource unless they were also added by another corpus or
|
1461
|
-
# modified in some way with the **Add custom words** or **Add a custom
|
1462
|
-
# method. Removing a corpus does not affect the custom model until you train
|
1463
|
-
# model with the **Train a custom language model** method. You must use
|
1464
|
-
# for the instance of the service that owns a model to delete its
|
1594
|
+
# out-of-vocabulary (OOV) words that are associated with the corpus from the custom
|
1595
|
+
# model's words resource unless they were also added by another corpus or grammar,
|
1596
|
+
# or they were modified in some way with the **Add custom words** or **Add a custom
|
1597
|
+
# word** method. Removing a corpus does not affect the custom model until you train
|
1598
|
+
# the model with the **Train a custom language model** method. You must use
|
1599
|
+
# credentials for the instance of the service that owns a model to delete its
|
1600
|
+
# corpora.
|
1465
1601
|
#
|
1466
1602
|
# **See also:** [Deleting a corpus from a custom language
|
1467
|
-
# model](https://
|
1603
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-corpora.html#deleteCorpus).
|
1468
1604
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1469
|
-
# the request. You must make the request with
|
1470
|
-
#
|
1605
|
+
# the request. You must make the request with credentials for the instance of the
|
1606
|
+
# service that owns the custom model.
|
1471
1607
|
# @param corpus_name [String] The name of the corpus for the custom language model.
|
1472
1608
|
# @return [nil]
|
1473
1609
|
def delete_corpus(customization_id:, corpus_name:)
|
@@ -1498,20 +1634,21 @@ module IBMWatson
|
|
1498
1634
|
# Lists information about custom words from a custom language model. You can list
|
1499
1635
|
# all words from the custom model's words resource, only custom words that were
|
1500
1636
|
# added or modified by the user, or only out-of-vocabulary (OOV) words that were
|
1501
|
-
# extracted from corpora. You can also indicate the
|
1502
|
-
# return words; by default,
|
1503
|
-
# must use credentials for the instance of the
|
1504
|
-
# information about its words.
|
1637
|
+
# extracted from corpora or are recognized by grammars. You can also indicate the
|
1638
|
+
# order in which the service is to return words; by default, the service lists words
|
1639
|
+
# in ascending alphabetical order. You must use credentials for the instance of the
|
1640
|
+
# service that owns a model to list information about its words.
|
1505
1641
|
#
|
1506
1642
|
# **See also:** [Listing words from a custom language
|
1507
|
-
# model](https://
|
1643
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-words.html#listWords).
|
1508
1644
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1509
|
-
# the request. You must make the request with
|
1510
|
-
#
|
1645
|
+
# the request. You must make the request with credentials for the instance of the
|
1646
|
+
# service that owns the custom model.
|
1511
1647
|
# @param word_type [String] The type of words to be listed from the custom language model's words resource:
|
1512
1648
|
# * `all` (the default) shows all words.
|
1513
|
-
# * `user` shows only custom words that were added or modified by the user.
|
1649
|
+
# * `user` shows only custom words that were added or modified by the user directly.
|
1514
1650
|
# * `corpora` shows only OOV that were extracted from corpora.
|
1651
|
+
# * `grammars` shows only OOV words that are recognized by grammars.
|
1515
1652
|
# @param sort [String] Indicates the order in which the words are to be listed, `alphabetical` or by
|
1516
1653
|
# `count`. You can prepend an optional `+` or `-` to an argument to indicate whether
|
1517
1654
|
# the results are to be sorted in ascending or descending order. By default, words
|
@@ -1547,11 +1684,12 @@ module IBMWatson
|
|
1547
1684
|
# @!method add_words(customization_id:, words:)
|
1548
1685
|
# Add custom words.
|
1549
1686
|
# Adds one or more custom words to a custom language model. The service populates
|
1550
|
-
# the words resource for a custom model with out-of-vocabulary (OOV) words
|
1551
|
-
#
|
1552
|
-
# to modify existing words in the words resource. The words
|
1553
|
-
# contain a maximum of 30 thousand custom (OOV) words
|
1554
|
-
# service extracts from corpora and words that
|
1687
|
+
# the words resource for a custom model with out-of-vocabulary (OOV) words from each
|
1688
|
+
# corpus or grammar that is added to the model. You can use this method to add
|
1689
|
+
# additional words or to modify existing words in the words resource. The words
|
1690
|
+
# resource for a model can contain a maximum of 30 thousand custom (OOV) words. This
|
1691
|
+
# includes words that the service extracts from corpora and grammars and words that
|
1692
|
+
# you add directly.
|
1555
1693
|
#
|
1556
1694
|
# You must use credentials for the instance of the service that owns a model to add
|
1557
1695
|
# or modify custom words for the model. Adding or modifying custom words does not
|
@@ -1570,10 +1708,8 @@ module IBMWatson
|
|
1570
1708
|
# word.
|
1571
1709
|
# * The `display_as` field provides a different way of spelling the word in a
|
1572
1710
|
# transcript. Use the parameter when you want the word to appear different from its
|
1573
|
-
# usual representation or from its spelling in
|
1574
|
-
#
|
1575
|
-
# `IBM™`.
|
1576
|
-
#
|
1711
|
+
# usual representation or from its spelling in training data. For example, you might
|
1712
|
+
# indicate that the word `IBM(trademark)` is to be displayed as `IBM™`.
|
1577
1713
|
#
|
1578
1714
|
# If you add a custom word that already exists in the words resource for the custom
|
1579
1715
|
# model, the new definition overwrites the existing data for the word. If the
|
@@ -1583,14 +1719,14 @@ module IBMWatson
|
|
1583
1719
|
# The call returns an HTTP 201 response code if the input data is valid. It then
|
1584
1720
|
# asynchronously processes the words to add them to the model's words resource. The
|
1585
1721
|
# time that it takes for the analysis to complete depends on the number of new words
|
1586
|
-
# that you add but is generally faster than adding a corpus or
|
1722
|
+
# that you add but is generally faster than adding a corpus or grammar.
|
1587
1723
|
#
|
1588
1724
|
# You can monitor the status of the request by using the **List a custom language
|
1589
1725
|
# model** method to poll the model's status. Use a loop to check the status every 10
|
1590
1726
|
# seconds. The method returns a `Customization` object that includes a `status`
|
1591
1727
|
# field. A status of `ready` means that the words have been added to the custom
|
1592
|
-
# model. The service cannot accept requests to add new
|
1593
|
-
#
|
1728
|
+
# model. The service cannot accept requests to add new data or to train the model
|
1729
|
+
# until the existing request completes.
|
1594
1730
|
#
|
1595
1731
|
# You can use the **List custom words** or **List a custom word** method to review
|
1596
1732
|
# the words that you add. Words with an invalid `sounds_like` field include an
|
@@ -1600,14 +1736,14 @@ module IBMWatson
|
|
1600
1736
|
#
|
1601
1737
|
# **See also:**
|
1602
1738
|
# * [Working with custom
|
1603
|
-
# words](https://
|
1739
|
+
# words](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingWords)
|
1604
1740
|
# * [Add words to the custom language
|
1605
|
-
# model](https://
|
1741
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addWords).
|
1606
1742
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1607
|
-
# the request. You must make the request with
|
1608
|
-
#
|
1609
|
-
# @param words [Array[CustomWord]] An array of objects that provides information about each custom word
|
1610
|
-
# added to or updated in the custom language model.
|
1743
|
+
# the request. You must make the request with credentials for the instance of the
|
1744
|
+
# service that owns the custom model.
|
1745
|
+
# @param words [Array[CustomWord]] An array of `CustomWord` objects that provides information about each custom word
|
1746
|
+
# that is to be added to or updated in the custom language model.
|
1611
1747
|
# @return [nil]
|
1612
1748
|
def add_words(customization_id:, words:)
|
1613
1749
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1637,11 +1773,11 @@ module IBMWatson
|
|
1637
1773
|
# @!method add_word(customization_id:, word_name:, word: nil, sounds_like: nil, display_as: nil)
|
1638
1774
|
# Add a custom word.
|
1639
1775
|
# Adds a custom word to a custom language model. The service populates the words
|
1640
|
-
# resource for a custom model with out-of-vocabulary (OOV) words
|
1641
|
-
#
|
1642
|
-
# existing word in the words resource. The words resource for a model can
|
1643
|
-
# maximum of 30 thousand custom (OOV) words
|
1644
|
-
# extracts from corpora and words that you add directly.
|
1776
|
+
# resource for a custom model with out-of-vocabulary (OOV) words from each corpus or
|
1777
|
+
# grammar that is added to the model. You can use this method to add a word or to
|
1778
|
+
# modify an existing word in the words resource. The words resource for a model can
|
1779
|
+
# contain a maximum of 30 thousand custom (OOV) words. This includes words that the
|
1780
|
+
# service extracts from corpora and grammars and words that you add directly.
|
1645
1781
|
#
|
1646
1782
|
# You must use credentials for the instance of the service that owns a model to add
|
1647
1783
|
# or modify a custom word for the model. Adding or modifying a custom word does not
|
@@ -1659,10 +1795,8 @@ module IBMWatson
|
|
1659
1795
|
# word.
|
1660
1796
|
# * The `display_as` field provides a different way of spelling the word in a
|
1661
1797
|
# transcript. Use the parameter when you want the word to appear different from its
|
1662
|
-
# usual representation or from its spelling in
|
1663
|
-
#
|
1664
|
-
# `IBM™`.
|
1665
|
-
#
|
1798
|
+
# usual representation or from its spelling in training data. For example, you might
|
1799
|
+
# indicate that the word `IBM(trademark)` is to be displayed as `IBM™`.
|
1666
1800
|
#
|
1667
1801
|
# If you add a custom word that already exists in the words resource for the custom
|
1668
1802
|
# model, the new definition overwrites the existing data for the word. If the
|
@@ -1671,17 +1805,17 @@ module IBMWatson
|
|
1671
1805
|
#
|
1672
1806
|
# **See also:**
|
1673
1807
|
# * [Working with custom
|
1674
|
-
# words](https://
|
1808
|
+
# words](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#workingWords)
|
1675
1809
|
# * [Add words to the custom language
|
1676
|
-
# model](https://
|
1810
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-create.html#addWords).
|
1677
1811
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1678
|
-
# the request. You must make the request with
|
1679
|
-
#
|
1812
|
+
# the request. You must make the request with credentials for the instance of the
|
1813
|
+
# service that owns the custom model.
|
1680
1814
|
# @param word_name [String] The custom word that is to be added to or updated in the custom language model. Do
|
1681
1815
|
# not include spaces in the word. Use a `-` (dash) or `_` (underscore) to connect
|
1682
1816
|
# the tokens of compound words. URL-encode the word if it includes non-ASCII
|
1683
1817
|
# characters. For more information, see [Character
|
1684
|
-
# encoding](https://
|
1818
|
+
# encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
|
1685
1819
|
# @param word [String] For the **Add custom words** method, you must specify the custom word that is to
|
1686
1820
|
# be added to or updated in the custom model. Do not include spaces in the word. Use
|
1687
1821
|
# a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
|
@@ -1733,17 +1867,17 @@ module IBMWatson
|
|
1733
1867
|
# @!method get_word(customization_id:, word_name:)
|
1734
1868
|
# Get a custom word.
|
1735
1869
|
# Gets information about a custom word from a custom language model. You must use
|
1736
|
-
# credentials for the instance of the service that owns a model to
|
1870
|
+
# credentials for the instance of the service that owns a model to list information
|
1737
1871
|
# about its words.
|
1738
1872
|
#
|
1739
1873
|
# **See also:** [Listing words from a custom language
|
1740
|
-
# model](https://
|
1874
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-words.html#listWords).
|
1741
1875
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1742
|
-
# the request. You must make the request with
|
1743
|
-
#
|
1876
|
+
# the request. You must make the request with credentials for the instance of the
|
1877
|
+
# service that owns the custom model.
|
1744
1878
|
# @param word_name [String] The custom word that is to be read from the custom language model. URL-encode the
|
1745
1879
|
# word if it includes non-ASCII characters. For more information, see [Character
|
1746
|
-
# encoding](https://
|
1880
|
+
# encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
|
1747
1881
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1748
1882
|
def get_word(customization_id:, word_name:)
|
1749
1883
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1776,13 +1910,13 @@ module IBMWatson
|
|
1776
1910
|
# instance of the service that owns a model to delete its words.
|
1777
1911
|
#
|
1778
1912
|
# **See also:** [Deleting a word from a custom language
|
1779
|
-
# model](https://
|
1913
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/language-words.html#deleteWord).
|
1780
1914
|
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1781
|
-
# the request. You must make the request with
|
1782
|
-
#
|
1915
|
+
# the request. You must make the request with credentials for the instance of the
|
1916
|
+
# service that owns the custom model.
|
1783
1917
|
# @param word_name [String] The custom word that is to be deleted from the custom language model. URL-encode
|
1784
1918
|
# the word if it includes non-ASCII characters. For more information, see [Character
|
1785
|
-
# encoding](https://
|
1919
|
+
# encoding](https://cloud.ibm.com/docs/services/speech-to-text/language-resource.html#charEncoding).
|
1786
1920
|
# @return [nil]
|
1787
1921
|
def delete_word(customization_id:, word_name:)
|
1788
1922
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1803,6 +1937,212 @@ module IBMWatson
|
|
1803
1937
|
nil
|
1804
1938
|
end
|
1805
1939
|
#########################
|
1940
|
+
# Custom grammars
|
1941
|
+
#########################
|
1942
|
+
|
1943
|
+
##
|
1944
|
+
# @!method list_grammars(customization_id:)
|
1945
|
+
# List grammars.
|
1946
|
+
# Lists information about all grammars from a custom language model. The information
|
1947
|
+
# includes the total number of out-of-vocabulary (OOV) words, name, and status of
|
1948
|
+
# each grammar. You must use credentials for the instance of the service that owns a
|
1949
|
+
# model to list its grammars.
|
1950
|
+
#
|
1951
|
+
# **See also:** [Listing grammars from a custom language
|
1952
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/).
|
1953
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1954
|
+
# the request. You must make the request with credentials for the instance of the
|
1955
|
+
# service that owns the custom model.
|
1956
|
+
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1957
|
+
def list_grammars(customization_id:)
|
1958
|
+
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
1959
|
+
|
1960
|
+
headers = {
|
1961
|
+
}
|
1962
|
+
|
1963
|
+
method_url = "/v1/customizations/%s/grammars" % [ERB::Util.url_encode(customization_id)]
|
1964
|
+
|
1965
|
+
response = request(
|
1966
|
+
method: "GET",
|
1967
|
+
url: method_url,
|
1968
|
+
headers: headers,
|
1969
|
+
accept_json: true
|
1970
|
+
)
|
1971
|
+
response
|
1972
|
+
end
|
1973
|
+
|
1974
|
+
##
|
1975
|
+
# @!method add_grammar(customization_id:, grammar_name:, grammar_file:, content_type:, allow_overwrite: nil)
|
1976
|
+
# Add a grammar.
|
1977
|
+
# Adds a single grammar file to a custom language model. Submit a plain text file in
|
1978
|
+
# UTF-8 format that defines the grammar. Use multiple requests to submit multiple
|
1979
|
+
# grammar files. You must use credentials for the instance of the service that owns
|
1980
|
+
# a model to add a grammar to it. Adding a grammar does not affect the custom
|
1981
|
+
# language model until you train the model for the new data by using the **Train a
|
1982
|
+
# custom language model** method.
|
1983
|
+
#
|
1984
|
+
# The call returns an HTTP 201 response code if the grammar is valid. The service
|
1985
|
+
# then asynchronously processes the contents of the grammar and automatically
|
1986
|
+
# extracts new words that it finds. This can take a few seconds to complete
|
1987
|
+
# depending on the size and complexity of the grammar, as well as the current load
|
1988
|
+
# on the service. You cannot submit requests to add additional resources to the
|
1989
|
+
# custom model or to train the model until the service's analysis of the grammar for
|
1990
|
+
# the current request completes. Use the **Get a grammar** method to check the
|
1991
|
+
# status of the analysis.
|
1992
|
+
#
|
1993
|
+
# The service populates the model's words resource with any word that is recognized
|
1994
|
+
# by the grammar that is not found in the model's base vocabulary. These are
|
1995
|
+
# referred to as out-of-vocabulary (OOV) words. You can use the **List custom
|
1996
|
+
# words** method to examine the words resource and use other words-related methods
|
1997
|
+
# to eliminate typos and modify how words are pronounced as needed.
|
1998
|
+
#
|
1999
|
+
# To add a grammar that has the same name as an existing grammar, set the
|
2000
|
+
# `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting
|
2001
|
+
# an existing grammar causes the service to process the grammar file and extract OOV
|
2002
|
+
# words anew. Before doing so, it removes any OOV words associated with the existing
|
2003
|
+
# grammar from the model's words resource unless they were also added by another
|
2004
|
+
# resource or they have been modified in some way with the **Add custom words** or
|
2005
|
+
# **Add a custom word** method.
|
2006
|
+
#
|
2007
|
+
# The service limits the overall amount of data that you can add to a custom model
|
2008
|
+
# to a maximum of 10 million total words from all sources combined. Also, you can
|
2009
|
+
# add no more than 30 thousand OOV words to a model. This includes words that the
|
2010
|
+
# service extracts from corpora and grammars and words that you add directly.
|
2011
|
+
#
|
2012
|
+
# **See also:**
|
2013
|
+
# * [Working with grammars](https://cloud.ibm.com/docs/services/speech-to-text/)
|
2014
|
+
# * [Add grammars to the custom language
|
2015
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/).
|
2016
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
2017
|
+
# the request. You must make the request with credentials for the instance of the
|
2018
|
+
# service that owns the custom model.
|
2019
|
+
# @param grammar_name [String] The name of the new grammar for the custom language model. Use a localized name
|
2020
|
+
# that matches the language of the custom model and reflects the contents of the
|
2021
|
+
# grammar.
|
2022
|
+
# * Include a maximum of 128 characters in the name.
|
2023
|
+
# * Do not include spaces, slashes, or backslashes in the name.
|
2024
|
+
# * Do not use the name of an existing grammar or corpus that is already defined for
|
2025
|
+
# the custom model.
|
2026
|
+
# * Do not use the name `user`, which is reserved by the service to denote custom
|
2027
|
+
# words that are added or modified by the user.
|
2028
|
+
# @param grammar_file [String] A plain text file that contains the grammar in the format specified by the
|
2029
|
+
# `Content-Type` header. Encode the file in UTF-8 (ASCII is a subset of UTF-8).
|
2030
|
+
# Using any other encoding can lead to issues when compiling the grammar or to
|
2031
|
+
# unexpected results in decoding. The service ignores an encoding that is specified
|
2032
|
+
# in the header of the grammar.
|
2033
|
+
# @param content_type [String] The format (MIME type) of the grammar file:
|
2034
|
+
# * `application/srgs` for Augmented Backus-Naur Form (ABNF), which uses a
|
2035
|
+
# plain-text representation that is similar to traditional BNF grammars.
|
2036
|
+
# * `application/srgs+xml` for XML Form, which uses XML elements to represent the
|
2037
|
+
# grammar.
|
2038
|
+
# @param allow_overwrite [Boolean] If `true`, the specified grammar overwrites an existing grammar with the same
|
2039
|
+
# name. If `false`, the request fails if a grammar with the same name already
|
2040
|
+
# exists. The parameter has no effect if a grammar with the same name does not
|
2041
|
+
# already exist.
|
2042
|
+
# @return [nil]
|
2043
|
+
def add_grammar(customization_id:, grammar_name:, grammar_file:, content_type:, allow_overwrite: nil)
|
2044
|
+
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
2045
|
+
|
2046
|
+
raise ArgumentError.new("grammar_name must be provided") if grammar_name.nil?
|
2047
|
+
|
2048
|
+
raise ArgumentError.new("grammar_file must be provided") if grammar_file.nil?
|
2049
|
+
|
2050
|
+
raise ArgumentError.new("content_type must be provided") if content_type.nil?
|
2051
|
+
|
2052
|
+
headers = {
|
2053
|
+
"Content-Type" => content_type
|
2054
|
+
}
|
2055
|
+
|
2056
|
+
params = {
|
2057
|
+
"allow_overwrite" => allow_overwrite
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
data = grammar_file
|
2061
|
+
|
2062
|
+
method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
|
2063
|
+
|
2064
|
+
request(
|
2065
|
+
method: "POST",
|
2066
|
+
url: method_url,
|
2067
|
+
headers: headers,
|
2068
|
+
params: params,
|
2069
|
+
data: data,
|
2070
|
+
accept_json: true
|
2071
|
+
)
|
2072
|
+
nil
|
2073
|
+
end
|
2074
|
+
|
2075
|
+
##
|
2076
|
+
# @!method get_grammar(customization_id:, grammar_name:)
|
2077
|
+
# Get a grammar.
|
2078
|
+
# Gets information about a grammar from a custom language model. The information
|
2079
|
+
# includes the total number of out-of-vocabulary (OOV) words, name, and status of
|
2080
|
+
# the grammar. You must use credentials for the instance of the service that owns a
|
2081
|
+
# model to list its grammars.
|
2082
|
+
#
|
2083
|
+
# **See also:** [Listing grammars from a custom language
|
2084
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/).
|
2085
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
2086
|
+
# the request. You must make the request with credentials for the instance of the
|
2087
|
+
# service that owns the custom model.
|
2088
|
+
# @param grammar_name [String] The name of the grammar for the custom language model.
|
2089
|
+
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
2090
|
+
def get_grammar(customization_id:, grammar_name:)
|
2091
|
+
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
2092
|
+
|
2093
|
+
raise ArgumentError.new("grammar_name must be provided") if grammar_name.nil?
|
2094
|
+
|
2095
|
+
headers = {
|
2096
|
+
}
|
2097
|
+
|
2098
|
+
method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
|
2099
|
+
|
2100
|
+
response = request(
|
2101
|
+
method: "GET",
|
2102
|
+
url: method_url,
|
2103
|
+
headers: headers,
|
2104
|
+
accept_json: true
|
2105
|
+
)
|
2106
|
+
response
|
2107
|
+
end
|
2108
|
+
|
2109
|
+
##
|
2110
|
+
# @!method delete_grammar(customization_id:, grammar_name:)
|
2111
|
+
# Delete a grammar.
|
2112
|
+
# Deletes an existing grammar from a custom language model. The service removes any
|
2113
|
+
# out-of-vocabulary (OOV) words associated with the grammar from the custom model's
|
2114
|
+
# words resource unless they were also added by another resource or they were
|
2115
|
+
# modified in some way with the **Add custom words** or **Add a custom word**
|
2116
|
+
# method. Removing a grammar does not affect the custom model until you train the
|
2117
|
+
# model with the **Train a custom language model** method. You must use credentials
|
2118
|
+
# for the instance of the service that owns a model to delete its grammar.
|
2119
|
+
#
|
2120
|
+
# **See also:** [Deleting a grammar from a custom language
|
2121
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/).
|
2122
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
2123
|
+
# the request. You must make the request with credentials for the instance of the
|
2124
|
+
# service that owns the custom model.
|
2125
|
+
# @param grammar_name [String] The name of the grammar for the custom language model.
|
2126
|
+
# @return [nil]
|
2127
|
+
def delete_grammar(customization_id:, grammar_name:)
|
2128
|
+
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
2129
|
+
|
2130
|
+
raise ArgumentError.new("grammar_name must be provided") if grammar_name.nil?
|
2131
|
+
|
2132
|
+
headers = {
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
|
2136
|
+
|
2137
|
+
request(
|
2138
|
+
method: "DELETE",
|
2139
|
+
url: method_url,
|
2140
|
+
headers: headers,
|
2141
|
+
accept_json: true
|
2142
|
+
)
|
2143
|
+
nil
|
2144
|
+
end
|
2145
|
+
#########################
|
1806
2146
|
# Custom acoustic models
|
1807
2147
|
#########################
|
1808
2148
|
|
@@ -1815,7 +2155,7 @@ module IBMWatson
|
|
1815
2155
|
# it.
|
1816
2156
|
#
|
1817
2157
|
# **See also:** [Create a custom acoustic
|
1818
|
-
# model](https://
|
2158
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#createModel).
|
1819
2159
|
# @param name [String] A user-defined name for the new custom acoustic model. Use a name that is unique
|
1820
2160
|
# among all custom acoustic models that you own. Use a localized name that matches
|
1821
2161
|
# the language of the custom model. Use a name that describes the acoustic
|
@@ -1827,7 +2167,7 @@ module IBMWatson
|
|
1827
2167
|
#
|
1828
2168
|
# To determine whether a base model supports acoustic model customization, refer to
|
1829
2169
|
# [Language support for
|
1830
|
-
# customization](https://
|
2170
|
+
# customization](https://cloud.ibm.com/docs/services/speech-to-text/custom.html#languageSupport).
|
1831
2171
|
# @param description [String] A description of the new custom acoustic model. Use a localized description that
|
1832
2172
|
# matches the language of the custom model.
|
1833
2173
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
@@ -1867,10 +2207,10 @@ module IBMWatson
|
|
1867
2207
|
# a model to list information about it.
|
1868
2208
|
#
|
1869
2209
|
# **See also:** [Listing custom acoustic
|
1870
|
-
# models](https://
|
2210
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#listModels).
|
1871
2211
|
# @param language [String] The identifier of the language for which custom language or custom acoustic models
|
1872
2212
|
# are to be returned (for example, `en-US`). Omit the parameter to see all custom
|
1873
|
-
# language or custom acoustic models owned by the requesting
|
2213
|
+
# language or custom acoustic models that are owned by the requesting credentials.
|
1874
2214
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1875
2215
|
def list_acoustic_models(language: nil)
|
1876
2216
|
headers = {
|
@@ -1899,10 +2239,10 @@ module IBMWatson
|
|
1899
2239
|
# for the instance of the service that owns a model to list information about it.
|
1900
2240
|
#
|
1901
2241
|
# **See also:** [Listing custom acoustic
|
1902
|
-
# models](https://
|
2242
|
+
# models](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#listModels).
|
1903
2243
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1904
|
-
# the request. You must make the request with
|
1905
|
-
#
|
2244
|
+
# the request. You must make the request with credentials for the instance of the
|
2245
|
+
# service that owns the custom model.
|
1906
2246
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1907
2247
|
def get_acoustic_model(customization_id:)
|
1908
2248
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1930,10 +2270,10 @@ module IBMWatson
|
|
1930
2270
|
# model to delete it.
|
1931
2271
|
#
|
1932
2272
|
# **See also:** [Deleting a custom acoustic
|
1933
|
-
# model](https://
|
2273
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#deleteModel).
|
1934
2274
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1935
|
-
# the request. You must make the request with
|
1936
|
-
#
|
2275
|
+
# the request. You must make the request with credentials for the instance of the
|
2276
|
+
# service that owns the custom model.
|
1937
2277
|
# @return [nil]
|
1938
2278
|
def delete_acoustic_model(customization_id:)
|
1939
2279
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -1988,15 +2328,15 @@ module IBMWatson
|
|
1988
2328
|
# Training can fail to start for the following reasons:
|
1989
2329
|
# * The service is currently handling another request for the custom model, such as
|
1990
2330
|
# another training request or a request to add audio resources to the model.
|
1991
|
-
# * The custom model contains less than 10 minutes or more than
|
2331
|
+
# * The custom model contains less than 10 minutes or more than 100 hours of audio
|
1992
2332
|
# data.
|
1993
2333
|
# * One or more of the custom model's audio resources is invalid.
|
1994
2334
|
#
|
1995
2335
|
# **See also:** [Train the custom acoustic
|
1996
|
-
# model](https://
|
2336
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#trainModel).
|
1997
2337
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1998
|
-
# the request. You must make the request with
|
1999
|
-
#
|
2338
|
+
# the request. You must make the request with credentials for the instance of the
|
2339
|
+
# service that owns the custom model.
|
2000
2340
|
# @param custom_language_model_id [String] The customization ID (GUID) of a custom language model that is to be used during
|
2001
2341
|
# training of the custom acoustic model. Specify a custom language model that has
|
2002
2342
|
# been trained with verbatim transcriptions of the audio resources or that contains
|
@@ -2034,10 +2374,10 @@ module IBMWatson
|
|
2034
2374
|
# credentials for the instance of the service that owns a model to reset it.
|
2035
2375
|
#
|
2036
2376
|
# **See also:** [Resetting a custom acoustic
|
2037
|
-
# model](https://
|
2377
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-models.html#resetModel).
|
2038
2378
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2039
|
-
# the request. You must make the request with
|
2040
|
-
#
|
2379
|
+
# the request. You must make the request with credentials for the instance of the
|
2380
|
+
# service that owns the custom model.
|
2041
2381
|
# @return [nil]
|
2042
2382
|
def reset_acoustic_model(customization_id:)
|
2043
2383
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -2083,10 +2423,10 @@ module IBMWatson
|
|
2083
2423
|
# acoustic model was not trained with a custom language model.
|
2084
2424
|
#
|
2085
2425
|
# **See also:** [Upgrading a custom acoustic
|
2086
|
-
# model](https://
|
2426
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic).
|
2087
2427
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2088
|
-
# the request. You must make the request with
|
2089
|
-
#
|
2428
|
+
# the request. You must make the request with credentials for the instance of the
|
2429
|
+
# service that owns the custom model.
|
2090
2430
|
# @param custom_language_model_id [String] If the custom acoustic model was trained with a custom language model, the
|
2091
2431
|
# customization ID (GUID) of that custom language model. The custom language model
|
2092
2432
|
# must be upgraded before the custom acoustic model can be upgraded.
|
@@ -2127,10 +2467,10 @@ module IBMWatson
|
|
2127
2467
|
# the instance of the service that owns a model to list its audio resources.
|
2128
2468
|
#
|
2129
2469
|
# **See also:** [Listing audio resources for a custom acoustic
|
2130
|
-
# model](https://
|
2470
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#listAudio).
|
2131
2471
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2132
|
-
# the request. You must make the request with
|
2133
|
-
#
|
2472
|
+
# the request. You must make the request with credentials for the instance of the
|
2473
|
+
# service that owns the custom model.
|
2134
2474
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
2135
2475
|
def list_audio(customization_id:)
|
2136
2476
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -2167,8 +2507,8 @@ module IBMWatson
|
|
2167
2507
|
# You can use this method to add any number of audio resources to a custom model by
|
2168
2508
|
# calling the method once for each audio or archive file. But the addition of one
|
2169
2509
|
# audio resource must be fully complete before you can add another. You must add a
|
2170
|
-
# minimum of 10 minutes and a maximum of
|
2171
|
-
# just silence, to a custom acoustic model before you can train it. No audio
|
2510
|
+
# minimum of 10 minutes and a maximum of 100 hours of audio that includes speech,
|
2511
|
+
# not just silence, to a custom acoustic model before you can train it. No audio
|
2172
2512
|
# resource, audio- or archive-type, can be larger than 100 MB. To add an audio
|
2173
2513
|
# resource that has the same name as an existing audio resource, set the
|
2174
2514
|
# `allow_overwrite` parameter to `true`; otherwise, the request fails.
|
@@ -2189,7 +2529,8 @@ module IBMWatson
|
|
2189
2529
|
# every few seconds until it becomes `ok`.
|
2190
2530
|
#
|
2191
2531
|
# **See also:** [Add audio to the custom acoustic
|
2192
|
-
# model](https://
|
2532
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#addAudio).
|
2533
|
+
#
|
2193
2534
|
#
|
2194
2535
|
# ### Content types for audio-type resources
|
2195
2536
|
#
|
@@ -2199,6 +2540,7 @@ module IBMWatson
|
|
2199
2540
|
# the sampling rate, channels, and endianness where indicated.
|
2200
2541
|
# * `audio/basic` (Use only with narrowband models.)
|
2201
2542
|
# * `audio/flac`
|
2543
|
+
# * `audio/g729` (Use only with narrowband models.)
|
2202
2544
|
# * `audio/l16` (Specify the sampling rate (`rate`) and optionally the number of
|
2203
2545
|
# channels (`channels`) and endianness (`endianness`) of the audio.)
|
2204
2546
|
# * `audio/mp3`
|
@@ -2212,14 +2554,15 @@ module IBMWatson
|
|
2212
2554
|
# * `audio/webm;codecs=opus`
|
2213
2555
|
# * `audio/webm;codecs=vorbis`
|
2214
2556
|
#
|
2215
|
-
#
|
2557
|
+
# The sampling rate of an audio file must match the sampling rate of the base model
|
2558
|
+
# for the custom model: for broadband models, at least 16 kHz; for narrowband
|
2559
|
+
# models, at least 8 kHz. If the sampling rate of the audio is higher than the
|
2560
|
+
# minimum required rate, the service down-samples the audio to the appropriate rate.
|
2561
|
+
# If the sampling rate of the audio is lower than the minimum required rate, the
|
2562
|
+
# service labels the audio file as `invalid`.
|
2216
2563
|
#
|
2217
|
-
#
|
2218
|
-
#
|
2219
|
-
# narrowband models, at least 8 kHz. If the sampling rate of the audio is higher
|
2220
|
-
# than the minimum required rate, the service down-samples the audio to the
|
2221
|
-
# appropriate rate. If the sampling rate of the audio is lower than the minimum
|
2222
|
-
# required rate, the service labels the audio file as `invalid`.
|
2564
|
+
# **See also:** [Audio
|
2565
|
+
# formats](https://cloud.ibm.com/docs/services/speech-to-text/audio-formats.html).
|
2223
2566
|
#
|
2224
2567
|
# ### Content types for archive-type resources
|
2225
2568
|
#
|
@@ -2247,8 +2590,8 @@ module IBMWatson
|
|
2247
2590
|
# * Do not use the name of an audio file that has already been added to the custom
|
2248
2591
|
# model as part of an archive-type resource.
|
2249
2592
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2250
|
-
# the request. You must make the request with
|
2251
|
-
#
|
2593
|
+
# the request. You must make the request with credentials for the instance of the
|
2594
|
+
# service that owns the custom model.
|
2252
2595
|
# @param audio_name [String] The name of the new audio resource for the custom acoustic model. Use a localized
|
2253
2596
|
# name that matches the language of the custom model and reflects the contents of
|
2254
2597
|
# the resource.
|
@@ -2331,10 +2674,10 @@ module IBMWatson
|
|
2331
2674
|
# its audio resources.
|
2332
2675
|
#
|
2333
2676
|
# **See also:** [Listing audio resources for a custom acoustic
|
2334
|
-
# model](https://
|
2677
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#listAudio).
|
2335
2678
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2336
|
-
# the request. You must make the request with
|
2337
|
-
#
|
2679
|
+
# the request. You must make the request with credentials for the instance of the
|
2680
|
+
# service that owns the custom model.
|
2338
2681
|
# @param audio_name [String] The name of the audio resource for the custom acoustic model.
|
2339
2682
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
2340
2683
|
def get_audio(customization_id:, audio_name:)
|
@@ -2368,10 +2711,10 @@ module IBMWatson
|
|
2368
2711
|
# delete its audio resources.
|
2369
2712
|
#
|
2370
2713
|
# **See also:** [Deleting an audio resource from a custom acoustic
|
2371
|
-
# model](https://
|
2714
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-audio.html#deleteAudio).
|
2372
2715
|
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2373
|
-
# the request. You must make the request with
|
2374
|
-
#
|
2716
|
+
# the request. You must make the request with credentials for the instance of the
|
2717
|
+
# service that owns the custom model.
|
2375
2718
|
# @param audio_name [String] The name of the audio resource for the custom acoustic model.
|
2376
2719
|
# @return [nil]
|
2377
2720
|
def delete_audio(customization_id:, audio_name:)
|
@@ -2409,7 +2752,7 @@ module IBMWatson
|
|
2409
2752
|
# with a request that passes the data.
|
2410
2753
|
#
|
2411
2754
|
# **See also:** [Information
|
2412
|
-
# security](https://
|
2755
|
+
# security](https://cloud.ibm.com/docs/services/speech-to-text/information-security.html).
|
2413
2756
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
2414
2757
|
# @return [nil]
|
2415
2758
|
def delete_user_data(customer_id:)
|