ibm_watson 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ibm_watson/assistant_v1.rb +1 -145
- data/lib/ibm_watson/assistant_v2.rb +95 -5
- data/lib/ibm_watson/compare_comply_v1.rb +1 -1
- data/lib/ibm_watson/discovery_v1.rb +1 -1
- data/lib/ibm_watson/discovery_v2.rb +590 -9
- data/lib/ibm_watson/language_translator_v3.rb +153 -48
- data/lib/ibm_watson/natural_language_classifier_v1.rb +1 -1
- data/lib/ibm_watson/natural_language_understanding_v1.rb +7 -9
- data/lib/ibm_watson/personality_insights_v3.rb +1 -1
- data/lib/ibm_watson/speech_to_text_v1.rb +40 -34
- data/lib/ibm_watson/text_to_speech_v1.rb +18 -11
- data/lib/ibm_watson/tone_analyzer_v3.rb +1 -1
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v4.rb +1 -1
- data/test/integration/test_assistant_v2.rb +18 -0
- data/test/integration/test_discovery_v2.rb +118 -6
- data/test/integration/test_language_translator_v3.rb +5 -0
- data/test/unit/test_assistant_v1.rb +98 -98
- data/test/unit/test_assistant_v2.rb +40 -12
- data/test/unit/test_compare_comply_v1.rb +20 -20
- data/test/unit/test_discovery_v1.rb +125 -125
- data/test/unit/test_discovery_v2.rb +262 -29
- data/test/unit/test_language_translator_v3.rb +85 -24
- data/test/unit/test_natural_language_classifier_v1.rb +17 -17
- data/test/unit/test_natural_language_understanding_v1.rb +10 -10
- data/test/unit/test_personality_insights_v3.rb +14 -14
- data/test/unit/test_speech_to_text_v1.rb +97 -97
- data/test/unit/test_text_to_speech_v1.rb +41 -41
- data/test/unit/test_tone_analyzer_v3.rb +12 -12
- data/test/unit/test_visual_recognition_v3.rb +16 -16
- data/test/unit/test_visual_recognition_v4.rb +40 -40
- metadata +2 -2
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
# IBM Watson™ Language Translator translates text from one language to another.
|
18
|
-
# The service offers multiple IBM
|
18
|
+
# The service offers multiple IBM-provided translation models that you can customize based
|
19
19
|
# on your unique terminology and language. Use Language Translator to take news from
|
20
20
|
# across the globe and present it in your language, communicate with your customers in
|
21
21
|
# their own language, and more.
|
@@ -33,7 +33,7 @@ module IBMWatson
|
|
33
33
|
class LanguageTranslatorV3 < IBMCloudSdkCore::BaseService
|
34
34
|
include Concurrent::Async
|
35
35
|
DEFAULT_SERVICE_NAME = "language_translator"
|
36
|
-
DEFAULT_SERVICE_URL = "https://
|
36
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.language-translator.watson.cloud.ibm.com"
|
37
37
|
##
|
38
38
|
# @!method initialize(args)
|
39
39
|
# Construct a new client for the Language Translator service.
|
@@ -71,6 +71,38 @@ module IBMWatson
|
|
71
71
|
@service_url = user_service_url unless user_service_url.nil?
|
72
72
|
end
|
73
73
|
|
74
|
+
#########################
|
75
|
+
# Languages
|
76
|
+
#########################
|
77
|
+
|
78
|
+
##
|
79
|
+
# @!method list_languages
|
80
|
+
# List supported languages.
|
81
|
+
# Lists all supported languages. The method returns an array of supported languages
|
82
|
+
# with information about each language. Languages are listed in alphabetical order
|
83
|
+
# by language code (for example, `af`, `ar`).
|
84
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
85
|
+
def list_languages
|
86
|
+
headers = {
|
87
|
+
}
|
88
|
+
sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_languages")
|
89
|
+
headers.merge!(sdk_headers)
|
90
|
+
|
91
|
+
params = {
|
92
|
+
"version" => @version
|
93
|
+
}
|
94
|
+
|
95
|
+
method_url = "/v3/languages"
|
96
|
+
|
97
|
+
response = request(
|
98
|
+
method: "GET",
|
99
|
+
url: method_url,
|
100
|
+
headers: headers,
|
101
|
+
params: params,
|
102
|
+
accept_json: true
|
103
|
+
)
|
104
|
+
response
|
105
|
+
end
|
74
106
|
#########################
|
75
107
|
# Translation
|
76
108
|
#########################
|
@@ -78,16 +110,21 @@ module IBMWatson
|
|
78
110
|
##
|
79
111
|
# @!method translate(text:, model_id: nil, source: nil, target: nil)
|
80
112
|
# Translate.
|
81
|
-
# Translates the input text from the source language to the target language.
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
113
|
+
# Translates the input text from the source language to the target language. Specify
|
114
|
+
# a model ID that indicates the source and target languages, or specify the source
|
115
|
+
# and target languages individually. You can omit the source language to have the
|
116
|
+
# service attempt to detect the language from the input text. If you omit the source
|
117
|
+
# language, the request must contain sufficient input text for the service to
|
118
|
+
# identify the source language.
|
119
|
+
# @param text [Array[String]] Input text in UTF-8 encoding. Multiple entries result in multiple translations in
|
120
|
+
# the response.
|
121
|
+
# @param model_id [String] The model to use for translation. For example, `en-de` selects the IBM-provided
|
122
|
+
# base model for English-to-German translation. A model ID overrides the `source`
|
123
|
+
# and `target` parameters and is required if you use a custom model. If no model ID
|
124
|
+
# is specified, you must specify at least a target language.
|
125
|
+
# @param source [String] Language code that specifies the language of the input text. If omitted, the
|
126
|
+
# service derives the source language from the input text. The input must contain
|
127
|
+
# sufficient text for the service to identify the language reliably.
|
91
128
|
# @param target [String] Language code that specifies the target language for translation. Required if
|
92
129
|
# model ID is not specified.
|
93
130
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -197,10 +234,11 @@ module IBMWatson
|
|
197
234
|
# Lists available translation models.
|
198
235
|
# @param source [String] Specify a language code to filter results by source language.
|
199
236
|
# @param target [String] Specify a language code to filter results by target language.
|
200
|
-
# @param default [Boolean] If the default parameter isn't specified, the service
|
237
|
+
# @param default [Boolean] If the `default` parameter isn't specified, the service returns all models
|
201
238
|
# (default and non-default) for each language pair. To return only default models,
|
202
|
-
# set this to `true`. To return only non-default models, set this
|
203
|
-
# is exactly one default model
|
239
|
+
# set this parameter to `true`. To return only non-default models, set this
|
240
|
+
# parameter to `false`. There is exactly one default model, the IBM-provided base
|
241
|
+
# model, per language pair.
|
204
242
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
205
243
|
def list_models(source: nil, target: nil, default: nil)
|
206
244
|
headers = {
|
@@ -230,36 +268,101 @@ module IBMWatson
|
|
230
268
|
##
|
231
269
|
# @!method create_model(base_model_id:, forced_glossary: nil, parallel_corpus: nil, name: nil)
|
232
270
|
# Create model.
|
233
|
-
# Uploads
|
271
|
+
# Uploads training files to customize a translation model. You can customize a model
|
272
|
+
# with a forced glossary or with a parallel corpus:
|
273
|
+
# * Use a *forced glossary* to force certain terms and phrases to be translated in a
|
274
|
+
# specific way. You can upload only a single forced glossary file for a model. The
|
275
|
+
# size of a forced glossary file for a custom model is limited to 10 MB.
|
276
|
+
# * Use a *parallel corpus* when you want your custom model to learn from general
|
277
|
+
# translation patterns in parallel sentences in your samples. What your model learns
|
278
|
+
# from a parallel corpus can improve translation results for input text that the
|
279
|
+
# model has not been trained on. You can upload multiple parallel corpora files with
|
280
|
+
# a request. To successfully train with parallel corpora, the corpora files must
|
281
|
+
# contain a cumulative total of at least 5000 parallel sentences. The cumulative
|
282
|
+
# size of all uploaded corpus files for a custom model is limited to 250 MB.
|
283
|
+
#
|
284
|
+
# Depending on the type of customization and the size of the uploaded files,
|
285
|
+
# training time can range from minutes for a glossary to several hours for a large
|
286
|
+
# parallel corpus. To create a model that is customized with a parallel corpus and a
|
287
|
+
# forced glossary, customize the model with a parallel corpus first and then
|
288
|
+
# customize the resulting model with a forced glossary.
|
289
|
+
#
|
290
|
+
# You can create a maximum of 10 custom models per language pair. For more
|
291
|
+
# information about customizing a translation model, including the formatting and
|
292
|
+
# character restrictions for data files, see [Customizing your
|
293
|
+
# model](https://cloud.ibm.com/docs/language-translator?topic=language-translator-customizing).
|
294
|
+
#
|
295
|
+
#
|
296
|
+
# #### Supported file formats
|
297
|
+
#
|
298
|
+
# You can provide your training data for customization in the following document
|
299
|
+
# formats:
|
300
|
+
# * **TMX** (`.tmx`) - Translation Memory eXchange (TMX) is an XML specification for
|
301
|
+
# the exchange of translation memories.
|
302
|
+
# * **XLIFF** (`.xliff`) - XML Localization Interchange File Format (XLIFF) is an
|
303
|
+
# XML specification for the exchange of translation memories.
|
304
|
+
# * **CSV** (`.csv`) - Comma-separated values (CSV) file with two columns for
|
305
|
+
# aligned sentences and phrases. The first row contains the language code.
|
306
|
+
# * **TSV** (`.tsv` or `.tab`) - Tab-separated values (TSV) file with two columns
|
307
|
+
# for aligned sentences and phrases. The first row contains the language code.
|
308
|
+
# * **JSON** (`.json`) - Custom JSON format for specifying aligned sentences and
|
309
|
+
# phrases.
|
310
|
+
# * **Microsoft Excel** (`.xls` or `.xlsx`) - Excel file with the first two columns
|
311
|
+
# for aligned sentences and phrases. The first row contains the language code.
|
312
|
+
#
|
313
|
+
# You must encode all text data in UTF-8 format. For more information, see
|
314
|
+
# [Supported document formats for training
|
315
|
+
# data](https://cloud.ibm.com/docs/language-translator?topic=language-translator-customizing#supported-document-formats-for-training-data).
|
316
|
+
#
|
317
|
+
#
|
318
|
+
# #### Specifying file formats
|
319
|
+
#
|
320
|
+
# You can indicate the format of a file by including the file extension with the
|
321
|
+
# file name. Use the file extensions shown in **Supported file formats**.
|
322
|
+
#
|
323
|
+
# Alternatively, you can omit the file extension and specify one of the following
|
324
|
+
# `content-type` specifications for the file:
|
325
|
+
# * **TMX** - `application/x-tmx+xml`
|
326
|
+
# * **XLIFF** - `application/xliff+xml`
|
327
|
+
# * **CSV** - `text/csv`
|
328
|
+
# * **TSV** - `text/tab-separated-values`
|
329
|
+
# * **JSON** - `application/json`
|
330
|
+
# * **Microsoft Excel** -
|
331
|
+
# `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
|
332
|
+
#
|
333
|
+
# For example, with `curl`, use the following `content-type` specification to
|
334
|
+
# indicate the format of a CSV file named **glossary**:
|
335
|
+
#
|
336
|
+
# `--form "forced_glossary=@glossary;type=text/csv"`.
|
337
|
+
# @param base_model_id [String] The ID of the translation model to use as the base for customization. To see
|
338
|
+
# available models and IDs, use the `List models` method. Most models that are
|
339
|
+
# provided with the service are customizable. In addition, all models that you
|
340
|
+
# create with parallel corpora customization can be further customized with a forced
|
341
|
+
# glossary.
|
342
|
+
# @param forced_glossary [File] A file with forced glossary terms for the source and target languages. The
|
343
|
+
# customizations in the file completely overwrite the domain translation data,
|
344
|
+
# including high frequency or high confidence phrase translations.
|
345
|
+
#
|
346
|
+
# You can upload only one glossary file for a custom model, and the glossary can
|
347
|
+
# have a maximum size of 10 MB. A forced glossary must contain single words or short
|
348
|
+
# phrases. For more information, see **Supported file formats** in the method
|
349
|
+
# description.
|
350
|
+
#
|
351
|
+
# *With `curl`, use `--form forced_glossary=@{filename}`.*.
|
352
|
+
# @param parallel_corpus [File] A file with parallel sentences for the source and target languages. You can upload
|
353
|
+
# multiple parallel corpus files in one request by repeating the parameter. All
|
354
|
+
# uploaded parallel corpus files combined must contain at least 5000 parallel
|
355
|
+
# sentences to train successfully. You can provide a maximum of 500,000 parallel
|
356
|
+
# sentences across all corpora.
|
234
357
|
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
# parallel corpus first and then customize the resulting model with a glossary.
|
239
|
-
# Depending on the type of customization and the size of the uploaded corpora,
|
240
|
-
# training can range from minutes for a glossary to several hours for a large
|
241
|
-
# parallel corpus. You can upload a single forced glossary file and this file must
|
242
|
-
# be less than <b>10 MB</b>. You can upload multiple parallel corpora tmx files. The
|
243
|
-
# cumulative file size of all uploaded files is limited to <b>250 MB</b>. To
|
244
|
-
# successfully train with a parallel corpus you must have at least <b>5,000 parallel
|
245
|
-
# sentences</b> in your corpus.
|
358
|
+
# A single entry in a corpus file can contain a maximum of 80 words. All corpora
|
359
|
+
# files for a custom model can have a cumulative maximum size of 250 MB. For more
|
360
|
+
# information, see **Supported file formats** in the method description.
|
246
361
|
#
|
247
|
-
#
|
248
|
-
# @param base_model_id [String] The model ID of the model to use as the base for customization. To see available
|
249
|
-
# models, use the `List models` method. Usually all IBM provided models are
|
250
|
-
# customizable. In addition, all your models that have been created via parallel
|
251
|
-
# corpus customization, can be further customized with a forced glossary.
|
252
|
-
# @param forced_glossary [File] A TMX file with your customizations. The customizations in the file completely
|
253
|
-
# overwrite the domain translaton data, including high frequency or high confidence
|
254
|
-
# phrase translations. You can upload only one glossary with a file size less than
|
255
|
-
# 10 MB per call. A forced glossary should contain single words or short phrases.
|
256
|
-
# @param parallel_corpus [File] A TMX file with parallel sentences for source and target language. You can upload
|
257
|
-
# multiple parallel_corpus files in one request. All uploaded parallel_corpus files
|
258
|
-
# combined, your parallel corpus must contain at least 5,000 parallel sentences to
|
259
|
-
# train successfully.
|
362
|
+
# *With `curl`, use `--form parallel_corpus=@{filename}`.*.
|
260
363
|
# @param name [String] An optional model name that you can use to identify the model. Valid characters
|
261
|
-
# are letters, numbers, dashes, underscores, spaces and apostrophes. The maximum
|
262
|
-
# length is 32 characters.
|
364
|
+
# are letters, numbers, dashes, underscores, spaces, and apostrophes. The maximum
|
365
|
+
# length of the name is 32 characters.
|
263
366
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
264
367
|
def create_model(base_model_id:, forced_glossary: nil, parallel_corpus: nil, name: nil)
|
265
368
|
raise ArgumentError.new("base_model_id must be provided") if base_model_id.nil?
|
@@ -339,7 +442,7 @@ module IBMWatson
|
|
339
442
|
# Get model details.
|
340
443
|
# Gets information about a translation model, including training status for custom
|
341
444
|
# models. Use this API call to poll the status of your customization request. A
|
342
|
-
# successfully completed training
|
445
|
+
# successfully completed training has a status of `available`.
|
343
446
|
# @param model_id [String] Model ID of the model to get.
|
344
447
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
345
448
|
def get_model(model_id:)
|
@@ -410,11 +513,13 @@ module IBMWatson
|
|
410
513
|
# Maximum file size: **20 MB**.
|
411
514
|
# @param filename [String] The filename for file.
|
412
515
|
# @param file_content_type [String] The content type of file.
|
413
|
-
# @param model_id [String] The model to use for translation. For example, `en-de` selects the IBM
|
414
|
-
# base model for English
|
415
|
-
# target parameters and is required if you use a custom model. If no model ID
|
416
|
-
# specified, you must specify a target language.
|
417
|
-
# @param source [String] Language code that specifies the language of the source document.
|
516
|
+
# @param model_id [String] The model to use for translation. For example, `en-de` selects the IBM-provided
|
517
|
+
# base model for English-to-German translation. A model ID overrides the `source`
|
518
|
+
# and `target` parameters and is required if you use a custom model. If no model ID
|
519
|
+
# is specified, you must specify at least a target language.
|
520
|
+
# @param source [String] Language code that specifies the language of the source document. If omitted, the
|
521
|
+
# service derives the source language from the input text. The input must contain
|
522
|
+
# sufficient text for the service to identify the language reliably.
|
418
523
|
# @param target [String] Language code that specifies the target language for translation. Required if
|
419
524
|
# model ID is not specified.
|
420
525
|
# @param document_id [String] To use a previously submitted document as the source for a new translation, enter
|
@@ -32,7 +32,7 @@ module IBMWatson
|
|
32
32
|
class NaturalLanguageClassifierV1 < IBMCloudSdkCore::BaseService
|
33
33
|
include Concurrent::Async
|
34
34
|
DEFAULT_SERVICE_NAME = "natural_language_classifier"
|
35
|
-
DEFAULT_SERVICE_URL = "https://
|
35
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com"
|
36
36
|
##
|
37
37
|
# @!method initialize(args)
|
38
38
|
# Construct a new client for the Natural Language Classifier service.
|
@@ -37,7 +37,7 @@ module IBMWatson
|
|
37
37
|
class NaturalLanguageUnderstandingV1 < IBMCloudSdkCore::BaseService
|
38
38
|
include Concurrent::Async
|
39
39
|
DEFAULT_SERVICE_NAME = "natural_language_understanding"
|
40
|
-
DEFAULT_SERVICE_URL = "https://
|
40
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"
|
41
41
|
##
|
42
42
|
# @!method initialize(args)
|
43
43
|
# Construct a new client for the Natural Language Understanding service.
|
@@ -92,7 +92,7 @@ module IBMWatson
|
|
92
92
|
# - Relations
|
93
93
|
# - Semantic roles
|
94
94
|
# - Sentiment
|
95
|
-
# - Syntax
|
95
|
+
# - Syntax.
|
96
96
|
#
|
97
97
|
# If a language for the input text is not specified with the `language` parameter,
|
98
98
|
# the service [automatically detects the
|
@@ -104,10 +104,9 @@ module IBMWatson
|
|
104
104
|
# required.
|
105
105
|
# @param url [String] The webpage to analyze. One of the `text`, `html`, or `url` parameters is
|
106
106
|
# required.
|
107
|
-
# @param clean [Boolean] Set this to `false` to disable webpage cleaning.
|
108
|
-
# cleaning, see
|
109
|
-
# webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages)
|
110
|
-
# documentation.
|
107
|
+
# @param clean [Boolean] Set this to `false` to disable webpage cleaning. For more information about
|
108
|
+
# webpage cleaning, see [Analyzing
|
109
|
+
# webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages).
|
111
110
|
# @param xpath [String] An [XPath
|
112
111
|
# query](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages#xpath)
|
113
112
|
# to perform on `html` or `url` input. Results of the query will be appended to the
|
@@ -117,9 +116,8 @@ module IBMWatson
|
|
117
116
|
# @param return_analyzed_text [Boolean] Whether or not to return the analyzed text.
|
118
117
|
# @param language [String] ISO 639-1 code that specifies the language of your text. This overrides automatic
|
119
118
|
# language detection. Language support differs depending on the features you include
|
120
|
-
# in your analysis.
|
121
|
-
# support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support)
|
122
|
-
# for more information.
|
119
|
+
# in your analysis. For more information, see [Language
|
120
|
+
# support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support).
|
123
121
|
# @param limit_text_characters [Fixnum] Sets the maximum number of characters that are processed by the service.
|
124
122
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
125
123
|
def analyze(features:, text: nil, html: nil, url: nil, clean: nil, xpath: nil, fallback_to_raw: nil, return_analyzed_text: nil, language: nil, limit_text_characters: nil)
|
@@ -48,7 +48,7 @@ module IBMWatson
|
|
48
48
|
class PersonalityInsightsV3 < IBMCloudSdkCore::BaseService
|
49
49
|
include Concurrent::Async
|
50
50
|
DEFAULT_SERVICE_NAME = "personality_insights"
|
51
|
-
DEFAULT_SERVICE_URL = "https://
|
51
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.personality-insights.watson.cloud.ibm.com"
|
52
52
|
##
|
53
53
|
# @!method initialize(args)
|
54
54
|
# Construct a new client for the Personality Insights service.
|
@@ -14,12 +14,12 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
# The IBM&
|
18
|
-
# capabilities to produce transcripts of spoken audio. The service can
|
19
|
-
# from various languages and audio formats. In addition to basic
|
20
|
-
# service can produce detailed information about many different aspects
|
21
|
-
# most languages, the service supports two sampling rates, broadband and
|
22
|
-
# returns all JSON response content in the UTF-8 character set.
|
17
|
+
# The IBM Watson™ Speech to Text service provides APIs that use IBM's
|
18
|
+
# speech-recognition capabilities to produce transcripts of spoken audio. The service can
|
19
|
+
# transcribe speech from various languages and audio formats. In addition to basic
|
20
|
+
# transcription, the service can produce detailed information about many different aspects
|
21
|
+
# of the audio. For most languages, the service supports two sampling rates, broadband and
|
22
|
+
# narrowband. It returns all JSON response content in the UTF-8 character set.
|
23
23
|
#
|
24
24
|
# For speech recognition, the service supports synchronous and asynchronous HTTP
|
25
25
|
# Representational State Transfer (REST) interfaces. It also supports a WebSocket
|
@@ -51,7 +51,7 @@ module IBMWatson
|
|
51
51
|
class SpeechToTextV1 < IBMCloudSdkCore::BaseService
|
52
52
|
include Concurrent::Async
|
53
53
|
DEFAULT_SERVICE_NAME = "speech_to_text"
|
54
|
-
DEFAULT_SERVICE_URL = "https://
|
54
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.speech-to-text.watson.cloud.ibm.com"
|
55
55
|
##
|
56
56
|
# @!method initialize(args)
|
57
57
|
# Construct a new client for the Speech to Text service.
|
@@ -84,7 +84,8 @@ module IBMWatson
|
|
84
84
|
# List models.
|
85
85
|
# Lists all language models that are available for use with the service. The
|
86
86
|
# information includes the name of the model and its minimum sampling rate in Hertz,
|
87
|
-
# among other things.
|
87
|
+
# among other things. The ordering of the list of models can change from call to
|
88
|
+
# call; do not rely on an alphabetized or static list of models.
|
88
89
|
#
|
89
90
|
# **See also:** [Languages and
|
90
91
|
# models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models#models).
|
@@ -335,11 +336,9 @@ module IBMWatson
|
|
335
336
|
# parameter to be `true`, regardless of whether you specify `false` for the
|
336
337
|
# parameter.
|
337
338
|
#
|
338
|
-
# **Note:** Applies to US English, German, Japanese, Korean, and
|
339
|
-
# broadband and narrowband models) and UK English (narrowband model)
|
340
|
-
# only.
|
341
|
-
# use the **Get a model** method and check that the attribute `speaker_labels` is
|
342
|
-
# set to `true`.
|
339
|
+
# **Note:** Applies to US English, Australian English, German, Japanese, Korean, and
|
340
|
+
# Spanish (both broadband and narrowband models) and UK English (narrowband model)
|
341
|
+
# transcription only.
|
343
342
|
#
|
344
343
|
# See [Speaker
|
345
344
|
# labels](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-output#speaker_labels).
|
@@ -681,9 +680,9 @@ module IBMWatson
|
|
681
680
|
# @!method register_callback(callback_url:, user_secret: nil)
|
682
681
|
# Register a callback.
|
683
682
|
# Registers a callback URL with the service for use with subsequent asynchronous
|
684
|
-
# recognition requests. The service attempts to register, or
|
685
|
-
#
|
686
|
-
#
|
683
|
+
# recognition requests. The service attempts to register, or allowlist, the callback
|
684
|
+
# URL if it is not already registered by sending a `GET` request to the callback
|
685
|
+
# URL. The service passes a random alphanumeric challenge string via the
|
687
686
|
# `challenge_string` parameter of the request. The request includes an `Accept`
|
688
687
|
# header that specifies `text/plain` as the required response type.
|
689
688
|
#
|
@@ -695,9 +694,9 @@ module IBMWatson
|
|
695
694
|
#
|
696
695
|
# The service sends only a single `GET` request to the callback URL. If the service
|
697
696
|
# does not receive a reply with a response code of 200 and a body that echoes the
|
698
|
-
# challenge string sent by the service within five seconds, it does not
|
697
|
+
# challenge string sent by the service within five seconds, it does not allowlist
|
699
698
|
# the URL; it instead sends status code 400 in response to the **Register a
|
700
|
-
# callback** request. If the requested callback URL is already
|
699
|
+
# callback** request. If the requested callback URL is already allowlisted, the
|
701
700
|
# service responds to the initial registration request with response code 200.
|
702
701
|
#
|
703
702
|
# If you specify a user secret with the request, the service uses it as a key to
|
@@ -715,7 +714,7 @@ module IBMWatson
|
|
715
714
|
# **See also:** [Registering a callback
|
716
715
|
# URL](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-async#register).
|
717
716
|
# @param callback_url [String] An HTTP or HTTPS URL to which callback notifications are to be sent. To be
|
718
|
-
#
|
717
|
+
# allowlisted, the URL must successfully echo the challenge string during URL
|
719
718
|
# verification. During verification, the client can also check the signature that
|
720
719
|
# the service sends in the `X-Callback-Signature` header to verify the origin of the
|
721
720
|
# request.
|
@@ -753,7 +752,7 @@ module IBMWatson
|
|
753
752
|
##
|
754
753
|
# @!method unregister_callback(callback_url:)
|
755
754
|
# Unregister a callback.
|
756
|
-
# Unregisters a callback URL that was previously
|
755
|
+
# Unregisters a callback URL that was previously allowlisted with a **Register a
|
757
756
|
# callback** request for use with the asynchronous interface. Once unregistered, the
|
758
757
|
# URL can no longer be used with asynchronous recognition requests.
|
759
758
|
#
|
@@ -891,7 +890,7 @@ module IBMWatson
|
|
891
890
|
# [Languages and
|
892
891
|
# models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models#models).
|
893
892
|
# @param callback_url [String] A URL to which callback notifications are to be sent. The URL must already be
|
894
|
-
# successfully
|
893
|
+
# successfully allowlisted by using the **Register a callback** method. You can
|
895
894
|
# include the same callback URL with any number of job creation requests. Omit the
|
896
895
|
# parameter to poll the service for job completion and results.
|
897
896
|
#
|
@@ -1024,11 +1023,9 @@ module IBMWatson
|
|
1024
1023
|
# parameter to be `true`, regardless of whether you specify `false` for the
|
1025
1024
|
# parameter.
|
1026
1025
|
#
|
1027
|
-
# **Note:** Applies to US English, German, Japanese, Korean, and
|
1028
|
-
# broadband and narrowband models) and UK English (narrowband model)
|
1029
|
-
# only.
|
1030
|
-
# use the **Get a model** method and check that the attribute `speaker_labels` is
|
1031
|
-
# set to `true`.
|
1026
|
+
# **Note:** Applies to US English, Australian English, German, Japanese, Korean, and
|
1027
|
+
# Spanish (both broadband and narrowband models) and UK English (narrowband model)
|
1028
|
+
# transcription only.
|
1032
1029
|
#
|
1033
1030
|
# See [Speaker
|
1034
1031
|
# labels](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-output#speaker_labels).
|
@@ -1393,8 +1390,10 @@ module IBMWatson
|
|
1393
1390
|
# **See also:** [Listing custom language
|
1394
1391
|
# models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language).
|
1395
1392
|
# @param language [String] The identifier of the language for which custom language or custom acoustic models
|
1396
|
-
# are to be returned
|
1397
|
-
#
|
1393
|
+
# are to be returned. Omit the parameter to see all custom language or custom
|
1394
|
+
# acoustic models that are owned by the requesting credentials. **Note:** The
|
1395
|
+
# `ar-AR` (Modern Standard Arabic) and `zh-CN` (Mandarin Chinese) languages are not
|
1396
|
+
# available for language model customization.
|
1398
1397
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1399
1398
|
def list_language_models(language: nil)
|
1400
1399
|
headers = {
|
@@ -2513,8 +2512,10 @@ module IBMWatson
|
|
2513
2512
|
# **See also:** [Listing custom acoustic
|
2514
2513
|
# models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic).
|
2515
2514
|
# @param language [String] The identifier of the language for which custom language or custom acoustic models
|
2516
|
-
# are to be returned
|
2517
|
-
#
|
2515
|
+
# are to be returned. Omit the parameter to see all custom language or custom
|
2516
|
+
# acoustic models that are owned by the requesting credentials. **Note:** The
|
2517
|
+
# `ar-AR` (Modern Standard Arabic) and `zh-CN` (Mandarin Chinese) languages are not
|
2518
|
+
# available for language model customization.
|
2518
2519
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2519
2520
|
def list_acoustic_models(language: nil)
|
2520
2521
|
headers = {
|
@@ -3131,10 +3132,15 @@ module IBMWatson
|
|
3131
3132
|
# deletes all data for the customer ID, regardless of the method by which the
|
3132
3133
|
# information was added. The method has no effect if no data is associated with the
|
3133
3134
|
# customer ID. You must issue the request with credentials for the same instance of
|
3134
|
-
# the service that was used to associate the customer ID with the data.
|
3135
|
-
#
|
3136
|
-
#
|
3137
|
-
#
|
3135
|
+
# the service that was used to associate the customer ID with the data. You
|
3136
|
+
# associate a customer ID with data by passing the `X-Watson-Metadata` header with a
|
3137
|
+
# request that passes the data.
|
3138
|
+
#
|
3139
|
+
# **Note:** If you delete an instance of the service from the service console, all
|
3140
|
+
# data associated with that service instance is automatically deleted. This includes
|
3141
|
+
# all custom language models, corpora, grammars, and words; all custom acoustic
|
3142
|
+
# models and audio resources; all registered endpoints for the asynchronous HTTP
|
3143
|
+
# interface; and all data related to speech recognition requests.
|
3138
3144
|
#
|
3139
3145
|
# **See also:** [Information
|
3140
3146
|
# security](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-information-security#information-security).
|