ibm_watson 0.11.0 → 0.12.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/README.md +40 -4
- data/lib/ibm_watson/assistant_v1.rb +54 -8
- data/lib/ibm_watson/assistant_v2.rb +5 -1
- data/lib/ibm_watson/compare_comply_v1.rb +27 -16
- data/lib/ibm_watson/discovery_v1.rb +96 -0
- data/lib/ibm_watson/language_translator_v3.rb +8 -0
- data/lib/ibm_watson/natural_language_classifier_v1.rb +8 -1
- data/lib/ibm_watson/natural_language_understanding_v1.rb +11 -7
- data/lib/ibm_watson/personality_insights_v3.rb +16 -9
- data/lib/ibm_watson/speech_to_text_v1.rb +70 -11
- data/lib/ibm_watson/text_to_speech_v1.rb +42 -23
- data/lib/ibm_watson/tone_analyzer_v3.rb +5 -2
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +10 -0
- data/lib/ibm_watson/watson_service.rb +59 -13
- data/test/unit/test_discovery_v1.rb +21 -2
- data/test/unit/test_watson_service.rb +15 -0
- metadata +2 -2
@@ -20,8 +20,8 @@
|
|
20
20
|
# can ignore most advertisements and other unwanted content.
|
21
21
|
#
|
22
22
|
# You can create [custom
|
23
|
-
# models](https://
|
24
|
-
# Knowledge Studio to detect custom entities and relations in Natural Language
|
23
|
+
# models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
|
24
|
+
# with Watson Knowledge Studio to detect custom entities and relations in Natural Language
|
25
25
|
# Understanding.
|
26
26
|
|
27
27
|
require "concurrent"
|
@@ -88,6 +88,7 @@ module IBMWatson
|
|
88
88
|
args[:vcap_services_name] = "natural-language-understanding"
|
89
89
|
super
|
90
90
|
@version = args[:version]
|
91
|
+
args[:display_name] = "Natural Language Understanding"
|
91
92
|
end
|
92
93
|
|
93
94
|
#########################
|
@@ -116,10 +117,10 @@ module IBMWatson
|
|
116
117
|
# required.
|
117
118
|
# @param clean [Boolean] Set this to `false` to disable webpage cleaning. To learn more about webpage
|
118
119
|
# cleaning, see the [Analyzing
|
119
|
-
# webpages](https://
|
120
|
+
# webpages](https://cloud.ibm.com/docs/services/natural-language-understanding/analyzing-webpages.html)
|
120
121
|
# documentation.
|
121
122
|
# @param xpath [String] An [XPath
|
122
|
-
# query](https://
|
123
|
+
# query](https://cloud.ibm.com/docs/services/natural-language-understanding/analyzing-webpages.html#xpath)
|
123
124
|
# to perform on `html` or `url` input. Results of the query will be appended to the
|
124
125
|
# cleaned webpage text before it is analyzed. To analyze only the results of the
|
125
126
|
# XPath query, set the `clean` parameter to `false`.
|
@@ -137,6 +138,7 @@ module IBMWatson
|
|
137
138
|
|
138
139
|
headers = {
|
139
140
|
}
|
141
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural-language-understanding;service_version=V1;operation_id=analyze"
|
140
142
|
|
141
143
|
params = {
|
142
144
|
"version" => @version
|
@@ -175,12 +177,13 @@ module IBMWatson
|
|
175
177
|
# @!method list_models
|
176
178
|
# List models.
|
177
179
|
# Lists Watson Knowledge Studio [custom
|
178
|
-
# models](https://
|
179
|
-
# deployed to your Natural Language Understanding service.
|
180
|
+
# models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
|
181
|
+
# that are deployed to your Natural Language Understanding service.
|
180
182
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
181
183
|
def list_models
|
182
184
|
headers = {
|
183
185
|
}
|
186
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural-language-understanding;service_version=V1;operation_id=list_models"
|
184
187
|
|
185
188
|
params = {
|
186
189
|
"version" => @version
|
@@ -202,13 +205,14 @@ module IBMWatson
|
|
202
205
|
# @!method delete_model(model_id:)
|
203
206
|
# Delete model.
|
204
207
|
# Deletes a custom model.
|
205
|
-
# @param model_id [String]
|
208
|
+
# @param model_id [String] Model ID of the model to delete.
|
206
209
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
207
210
|
def delete_model(model_id:)
|
208
211
|
raise ArgumentError.new("model_id must be provided") if model_id.nil?
|
209
212
|
|
210
213
|
headers = {
|
211
214
|
}
|
215
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural-language-understanding;service_version=V1;operation_id=delete_model"
|
212
216
|
|
213
217
|
params = {
|
214
218
|
"version" => @version
|
@@ -26,9 +26,10 @@
|
|
26
26
|
# is timestamped, can report temporal behavior.
|
27
27
|
# * For information about the meaning of the models that the service uses to describe
|
28
28
|
# personality characteristics, see [Personality
|
29
|
-
# models](https://
|
29
|
+
# models](https://cloud.ibm.com/docs/services/personality-insights/models.html).
|
30
30
|
# * For information about the meaning of the consumption preferences, see [Consumption
|
31
|
-
# preferences](https://
|
31
|
+
# preferences](https://cloud.ibm.com/docs/services/personality-insights/preferences.html).
|
32
|
+
#
|
32
33
|
#
|
33
34
|
# **Note:** Request logging is disabled for the Personality Insights service. Regardless
|
34
35
|
# of whether you set the `X-Watson-Learning-Opt-Out` request header, the service does not
|
@@ -98,6 +99,7 @@ module IBMWatson
|
|
98
99
|
args[:vcap_services_name] = "personality_insights"
|
99
100
|
super
|
100
101
|
@version = args[:version]
|
102
|
+
args[:display_name] = "Personality Insights"
|
101
103
|
end
|
102
104
|
|
103
105
|
#########################
|
@@ -114,9 +116,11 @@ module IBMWatson
|
|
114
116
|
#
|
115
117
|
#
|
116
118
|
# **See also:**
|
117
|
-
# * [Requesting a
|
119
|
+
# * [Requesting a
|
120
|
+
# profile](https://cloud.ibm.com/docs/services/personality-insights/input.html)
|
118
121
|
# * [Providing sufficient
|
119
|
-
# input](https://
|
122
|
+
# input](https://cloud.ibm.com/docs/services/personality-insights/input.html#sufficient)
|
123
|
+
#
|
120
124
|
#
|
121
125
|
# ### Content types
|
122
126
|
#
|
@@ -133,7 +137,8 @@ module IBMWatson
|
|
133
137
|
# `Content-Type: text/plain;charset=utf-8`.
|
134
138
|
#
|
135
139
|
# **See also:** [Specifying request and response
|
136
|
-
# formats](https://
|
140
|
+
# formats](https://cloud.ibm.com/docs/services/personality-insights/input.html#formats)
|
141
|
+
#
|
137
142
|
#
|
138
143
|
# ### Accept types
|
139
144
|
#
|
@@ -143,13 +148,14 @@ module IBMWatson
|
|
143
148
|
# optional column headers for CSV output.
|
144
149
|
#
|
145
150
|
# **See also:**
|
146
|
-
# * [Understanding a JSON
|
151
|
+
# * [Understanding a JSON
|
152
|
+
# profile](https://cloud.ibm.com/docs/services/personality-insights/output.html)
|
147
153
|
# * [Understanding a CSV
|
148
|
-
# profile](https://
|
154
|
+
# profile](https://cloud.ibm.com/docs/services/personality-insights/output-csv.html).
|
149
155
|
# @param content [Content] A maximum of 20 MB of content to analyze, though the service requires much less
|
150
156
|
# text; for more information, see [Providing sufficient
|
151
|
-
# input](https://
|
152
|
-
# provide an object of type `Content`.
|
157
|
+
# input](https://cloud.ibm.com/docs/services/personality-insights/input.html#sufficient).
|
158
|
+
# For JSON input, provide an object of type `Content`.
|
153
159
|
# @param accept [String] The type of the response. For more information, see **Accept types** in the method
|
154
160
|
# description.
|
155
161
|
# @param content_type [String] The type of the input. For more information, see **Content types** in the method
|
@@ -192,6 +198,7 @@ module IBMWatson
|
|
192
198
|
"Content-Language" => content_language,
|
193
199
|
"Accept-Language" => accept_language
|
194
200
|
}
|
201
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=personality_insights;service_version=V3;operation_id=profile"
|
195
202
|
|
196
203
|
params = {
|
197
204
|
"version" => @version,
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
# The IBM® Speech to Text service provides APIs that use IBM's speech-recognition
|
18
18
|
# capabilities to produce transcripts of spoken audio. The service can transcribe speech
|
19
|
-
# from various languages and audio formats.
|
19
|
+
# from various languages and audio formats. In addition to basic transcription, the
|
20
20
|
# service can produce detailed information about many different aspects of the audio. For
|
21
21
|
# most languages, the service supports two sampling rates, broadband and narrowband. It
|
22
22
|
# returns all JSON response content in the UTF-8 character set.
|
@@ -90,6 +90,7 @@ module IBMWatson
|
|
90
90
|
args = defaults.merge(args)
|
91
91
|
args[:vcap_services_name] = "speech_to_text"
|
92
92
|
super
|
93
|
+
args[:display_name] = "Speech to Text"
|
93
94
|
end
|
94
95
|
|
95
96
|
#########################
|
@@ -109,6 +110,7 @@ module IBMWatson
|
|
109
110
|
def list_models
|
110
111
|
headers = {
|
111
112
|
}
|
113
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_models"
|
112
114
|
|
113
115
|
method_url = "/v1/models"
|
114
116
|
|
@@ -138,6 +140,7 @@ module IBMWatson
|
|
138
140
|
|
139
141
|
headers = {
|
140
142
|
}
|
143
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_model"
|
141
144
|
|
142
145
|
method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
|
143
146
|
|
@@ -375,6 +378,8 @@ module IBMWatson
|
|
375
378
|
"Content-Type" => content_type
|
376
379
|
}
|
377
380
|
keywords *= "," unless keywords.nil?
|
381
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=recognize"
|
382
|
+
|
378
383
|
params = {
|
379
384
|
"model" => model,
|
380
385
|
"language_customization_id" => language_customization_id,
|
@@ -487,7 +492,9 @@ module IBMWatson
|
|
487
492
|
raise TypeError("Callback is not a derived class of RecognizeCallback") unless recognize_callback.is_a?(IBMWatson::RecognizeCallback)
|
488
493
|
|
489
494
|
require_relative("./websocket/speech_to_text_websocket_listener.rb")
|
490
|
-
headers = {
|
495
|
+
headers = {
|
496
|
+
}
|
497
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=discovery;service_version=V1;operation_id=recognize_using_websocket"
|
491
498
|
headers = conn.default_options.headers.to_hash unless conn.default_options.headers.to_hash.empty?
|
492
499
|
if !token_manager.nil?
|
493
500
|
access_token = token_manager.token
|
@@ -502,9 +509,7 @@ module IBMWatson
|
|
502
509
|
"langauge_customization_id" => language_customization_id,
|
503
510
|
"acoustic_customization_id" => acoustic_customization_id,
|
504
511
|
"customization_weight" => customization_weight,
|
505
|
-
"base_model_version" => base_model_version
|
506
|
-
"grammar_name" => grammar_name,
|
507
|
-
"redaction" => redaction
|
512
|
+
"base_model_version" => base_model_version
|
508
513
|
}
|
509
514
|
params.delete_if { |_, v| v.nil? }
|
510
515
|
url += "/v1/recognize?" + HTTP::URI.form_encode(params)
|
@@ -520,7 +525,9 @@ module IBMWatson
|
|
520
525
|
"timestamps" => timestamps,
|
521
526
|
"profanity_filter" => profanity_filter,
|
522
527
|
"smart_formatting" => smart_formatting,
|
523
|
-
"speaker_labels" => speaker_labels
|
528
|
+
"speaker_labels" => speaker_labels,
|
529
|
+
"grammar_name" => grammar_name,
|
530
|
+
"redaction" => redaction
|
524
531
|
}
|
525
532
|
options.delete_if { |_, v| v.nil? }
|
526
533
|
WebSocketClient.new(audio: audio, chunk_data: chunk_data, options: options, recognize_callback: recognize_callback, url: url, headers: headers)
|
@@ -632,6 +639,7 @@ module IBMWatson
|
|
632
639
|
|
633
640
|
headers = {
|
634
641
|
}
|
642
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=register_callback"
|
635
643
|
|
636
644
|
params = {
|
637
645
|
"callback_url" => callback_url,
|
@@ -666,6 +674,7 @@ module IBMWatson
|
|
666
674
|
|
667
675
|
headers = {
|
668
676
|
}
|
677
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=unregister_callback"
|
669
678
|
|
670
679
|
params = {
|
671
680
|
"callback_url" => callback_url
|
@@ -949,6 +958,7 @@ module IBMWatson
|
|
949
958
|
headers = {
|
950
959
|
"Content-Type" => content_type
|
951
960
|
}
|
961
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=create_job"
|
952
962
|
|
953
963
|
params = {
|
954
964
|
"model" => model,
|
@@ -1008,6 +1018,7 @@ module IBMWatson
|
|
1008
1018
|
def check_jobs
|
1009
1019
|
headers = {
|
1010
1020
|
}
|
1021
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=check_jobs"
|
1011
1022
|
|
1012
1023
|
method_url = "/v1/recognitions"
|
1013
1024
|
|
@@ -1046,6 +1057,7 @@ module IBMWatson
|
|
1046
1057
|
|
1047
1058
|
headers = {
|
1048
1059
|
}
|
1060
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=check_job"
|
1049
1061
|
|
1050
1062
|
method_url = "/v1/recognitions/%s" % [ERB::Util.url_encode(id)]
|
1051
1063
|
|
@@ -1078,6 +1090,7 @@ module IBMWatson
|
|
1078
1090
|
|
1079
1091
|
headers = {
|
1080
1092
|
}
|
1093
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_job"
|
1081
1094
|
|
1082
1095
|
method_url = "/v1/recognitions/%s" % [ERB::Util.url_encode(id)]
|
1083
1096
|
|
@@ -1136,6 +1149,7 @@ module IBMWatson
|
|
1136
1149
|
|
1137
1150
|
headers = {
|
1138
1151
|
}
|
1152
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=create_language_model"
|
1139
1153
|
|
1140
1154
|
data = {
|
1141
1155
|
"name" => name,
|
@@ -1174,6 +1188,7 @@ module IBMWatson
|
|
1174
1188
|
def list_language_models(language: nil)
|
1175
1189
|
headers = {
|
1176
1190
|
}
|
1191
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_language_models"
|
1177
1192
|
|
1178
1193
|
params = {
|
1179
1194
|
"language" => language
|
@@ -1208,6 +1223,7 @@ module IBMWatson
|
|
1208
1223
|
|
1209
1224
|
headers = {
|
1210
1225
|
}
|
1226
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_language_model"
|
1211
1227
|
|
1212
1228
|
method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
|
1213
1229
|
|
@@ -1239,6 +1255,7 @@ module IBMWatson
|
|
1239
1255
|
|
1240
1256
|
headers = {
|
1241
1257
|
}
|
1258
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_language_model"
|
1242
1259
|
|
1243
1260
|
method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
|
1244
1261
|
|
@@ -1314,6 +1331,7 @@ module IBMWatson
|
|
1314
1331
|
|
1315
1332
|
headers = {
|
1316
1333
|
}
|
1334
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=train_language_model"
|
1317
1335
|
|
1318
1336
|
params = {
|
1319
1337
|
"word_type_to_add" => word_type_to_add,
|
@@ -1353,6 +1371,7 @@ module IBMWatson
|
|
1353
1371
|
|
1354
1372
|
headers = {
|
1355
1373
|
}
|
1374
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=reset_language_model"
|
1356
1375
|
|
1357
1376
|
method_url = "/v1/customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
|
1358
1377
|
|
@@ -1395,6 +1414,7 @@ module IBMWatson
|
|
1395
1414
|
|
1396
1415
|
headers = {
|
1397
1416
|
}
|
1417
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=upgrade_language_model"
|
1398
1418
|
|
1399
1419
|
method_url = "/v1/customizations/%s/upgrade_model" % [ERB::Util.url_encode(customization_id)]
|
1400
1420
|
|
@@ -1429,6 +1449,7 @@ module IBMWatson
|
|
1429
1449
|
|
1430
1450
|
headers = {
|
1431
1451
|
}
|
1452
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_corpora"
|
1432
1453
|
|
1433
1454
|
method_url = "/v1/customizations/%s/corpora" % [ERB::Util.url_encode(customization_id)]
|
1434
1455
|
|
@@ -1527,6 +1548,7 @@ module IBMWatson
|
|
1527
1548
|
|
1528
1549
|
headers = {
|
1529
1550
|
}
|
1551
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_corpus"
|
1530
1552
|
|
1531
1553
|
params = {
|
1532
1554
|
"allow_overwrite" => allow_overwrite
|
@@ -1575,6 +1597,7 @@ module IBMWatson
|
|
1575
1597
|
|
1576
1598
|
headers = {
|
1577
1599
|
}
|
1600
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_corpus"
|
1578
1601
|
|
1579
1602
|
method_url = "/v1/customizations/%s/corpora/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(corpus_name)]
|
1580
1603
|
|
@@ -1613,6 +1636,7 @@ module IBMWatson
|
|
1613
1636
|
|
1614
1637
|
headers = {
|
1615
1638
|
}
|
1639
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_corpus"
|
1616
1640
|
|
1617
1641
|
method_url = "/v1/customizations/%s/corpora/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(corpus_name)]
|
1618
1642
|
|
@@ -1662,6 +1686,7 @@ module IBMWatson
|
|
1662
1686
|
|
1663
1687
|
headers = {
|
1664
1688
|
}
|
1689
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_words"
|
1665
1690
|
|
1666
1691
|
params = {
|
1667
1692
|
"word_type" => word_type,
|
@@ -1752,6 +1777,7 @@ module IBMWatson
|
|
1752
1777
|
|
1753
1778
|
headers = {
|
1754
1779
|
}
|
1780
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_words"
|
1755
1781
|
|
1756
1782
|
data = {
|
1757
1783
|
"words" => words
|
@@ -1844,6 +1870,7 @@ module IBMWatson
|
|
1844
1870
|
|
1845
1871
|
headers = {
|
1846
1872
|
}
|
1873
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_word"
|
1847
1874
|
|
1848
1875
|
data = {
|
1849
1876
|
"word" => word,
|
@@ -1886,6 +1913,7 @@ module IBMWatson
|
|
1886
1913
|
|
1887
1914
|
headers = {
|
1888
1915
|
}
|
1916
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_word"
|
1889
1917
|
|
1890
1918
|
method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]
|
1891
1919
|
|
@@ -1925,6 +1953,7 @@ module IBMWatson
|
|
1925
1953
|
|
1926
1954
|
headers = {
|
1927
1955
|
}
|
1956
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_word"
|
1928
1957
|
|
1929
1958
|
method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]
|
1930
1959
|
|
@@ -1959,6 +1988,7 @@ module IBMWatson
|
|
1959
1988
|
|
1960
1989
|
headers = {
|
1961
1990
|
}
|
1991
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_grammars"
|
1962
1992
|
|
1963
1993
|
method_url = "/v1/customizations/%s/grammars" % [ERB::Util.url_encode(customization_id)]
|
1964
1994
|
|
@@ -2052,6 +2082,7 @@ module IBMWatson
|
|
2052
2082
|
headers = {
|
2053
2083
|
"Content-Type" => content_type
|
2054
2084
|
}
|
2085
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_grammar"
|
2055
2086
|
|
2056
2087
|
params = {
|
2057
2088
|
"allow_overwrite" => allow_overwrite
|
@@ -2094,6 +2125,7 @@ module IBMWatson
|
|
2094
2125
|
|
2095
2126
|
headers = {
|
2096
2127
|
}
|
2128
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_grammar"
|
2097
2129
|
|
2098
2130
|
method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
|
2099
2131
|
|
@@ -2131,6 +2163,7 @@ module IBMWatson
|
|
2131
2163
|
|
2132
2164
|
headers = {
|
2133
2165
|
}
|
2166
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_grammar"
|
2134
2167
|
|
2135
2168
|
method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
|
2136
2169
|
|
@@ -2178,6 +2211,7 @@ module IBMWatson
|
|
2178
2211
|
|
2179
2212
|
headers = {
|
2180
2213
|
}
|
2214
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=create_acoustic_model"
|
2181
2215
|
|
2182
2216
|
data = {
|
2183
2217
|
"name" => name,
|
@@ -2215,6 +2249,7 @@ module IBMWatson
|
|
2215
2249
|
def list_acoustic_models(language: nil)
|
2216
2250
|
headers = {
|
2217
2251
|
}
|
2252
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_acoustic_models"
|
2218
2253
|
|
2219
2254
|
params = {
|
2220
2255
|
"language" => language
|
@@ -2249,6 +2284,7 @@ module IBMWatson
|
|
2249
2284
|
|
2250
2285
|
headers = {
|
2251
2286
|
}
|
2287
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_acoustic_model"
|
2252
2288
|
|
2253
2289
|
method_url = "/v1/acoustic_customizations/%s" % [ERB::Util.url_encode(customization_id)]
|
2254
2290
|
|
@@ -2280,6 +2316,7 @@ module IBMWatson
|
|
2280
2316
|
|
2281
2317
|
headers = {
|
2282
2318
|
}
|
2319
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_acoustic_model"
|
2283
2320
|
|
2284
2321
|
method_url = "/v1/acoustic_customizations/%s" % [ERB::Util.url_encode(customization_id)]
|
2285
2322
|
|
@@ -2331,6 +2368,9 @@ module IBMWatson
|
|
2331
2368
|
# * The custom model contains less than 10 minutes or more than 100 hours of audio
|
2332
2369
|
# data.
|
2333
2370
|
# * One or more of the custom model's audio resources is invalid.
|
2371
|
+
# * You passed an incompatible custom language model with the
|
2372
|
+
# `custom_language_model_id` query parameter. Both custom models must be based on
|
2373
|
+
# the same version of the same base model.
|
2334
2374
|
#
|
2335
2375
|
# **See also:** [Train the custom acoustic
|
2336
2376
|
# model](https://cloud.ibm.com/docs/services/speech-to-text/acoustic-create.html#trainModel).
|
@@ -2340,13 +2380,17 @@ module IBMWatson
|
|
2340
2380
|
# @param custom_language_model_id [String] The customization ID (GUID) of a custom language model that is to be used during
|
2341
2381
|
# training of the custom acoustic model. Specify a custom language model that has
|
2342
2382
|
# been trained with verbatim transcriptions of the audio resources or that contains
|
2343
|
-
# words that are relevant to the contents of the audio resources.
|
2383
|
+
# words that are relevant to the contents of the audio resources. The custom
|
2384
|
+
# language model must be based on the same version of the same base model as the
|
2385
|
+
# custom acoustic model. The credentials specified with the request must own both
|
2386
|
+
# custom models.
|
2344
2387
|
# @return [nil]
|
2345
2388
|
def train_acoustic_model(customization_id:, custom_language_model_id: nil)
|
2346
2389
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
2347
2390
|
|
2348
2391
|
headers = {
|
2349
2392
|
}
|
2393
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=train_acoustic_model"
|
2350
2394
|
|
2351
2395
|
params = {
|
2352
2396
|
"custom_language_model_id" => custom_language_model_id
|
@@ -2384,6 +2428,7 @@ module IBMWatson
|
|
2384
2428
|
|
2385
2429
|
headers = {
|
2386
2430
|
}
|
2431
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=reset_acoustic_model"
|
2387
2432
|
|
2388
2433
|
method_url = "/v1/acoustic_customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
|
2389
2434
|
|
@@ -2397,7 +2442,7 @@ module IBMWatson
|
|
2397
2442
|
end
|
2398
2443
|
|
2399
2444
|
##
|
2400
|
-
# @!method upgrade_acoustic_model(customization_id:, custom_language_model_id: nil)
|
2445
|
+
# @!method upgrade_acoustic_model(customization_id:, custom_language_model_id: nil, force: nil)
|
2401
2446
|
# Upgrade a custom acoustic model.
|
2402
2447
|
# Initiates the upgrade of a custom acoustic model to the latest version of its base
|
2403
2448
|
# language model. The upgrade method is asynchronous. It can take on the order of
|
@@ -2429,16 +2474,25 @@ module IBMWatson
|
|
2429
2474
|
# service that owns the custom model.
|
2430
2475
|
# @param custom_language_model_id [String] If the custom acoustic model was trained with a custom language model, the
|
2431
2476
|
# customization ID (GUID) of that custom language model. The custom language model
|
2432
|
-
# must be upgraded before the custom acoustic model can be upgraded.
|
2477
|
+
# must be upgraded before the custom acoustic model can be upgraded. The credentials
|
2478
|
+
# specified with the request must own both custom models.
|
2479
|
+
# @param force [Boolean] If `true`, forces the upgrade of a custom acoustic model for which no input data
|
2480
|
+
# has been modified since it was last trained. Use this parameter only to force the
|
2481
|
+
# upgrade of a custom acoustic model that is trained with a custom language model,
|
2482
|
+
# and only if you receive a 400 response code and the message `No input data
|
2483
|
+
# modified since last training`. See [Upgrading a custom acoustic
|
2484
|
+
# model](https://cloud.ibm.com/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic).
|
2433
2485
|
# @return [nil]
|
2434
|
-
def upgrade_acoustic_model(customization_id:, custom_language_model_id: nil)
|
2486
|
+
def upgrade_acoustic_model(customization_id:, custom_language_model_id: nil, force: nil)
|
2435
2487
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
2436
2488
|
|
2437
2489
|
headers = {
|
2438
2490
|
}
|
2491
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=upgrade_acoustic_model"
|
2439
2492
|
|
2440
2493
|
params = {
|
2441
|
-
"custom_language_model_id" => custom_language_model_id
|
2494
|
+
"custom_language_model_id" => custom_language_model_id,
|
2495
|
+
"force" => force
|
2442
2496
|
}
|
2443
2497
|
|
2444
2498
|
method_url = "/v1/acoustic_customizations/%s/upgrade_model" % [ERB::Util.url_encode(customization_id)]
|
@@ -2477,6 +2531,7 @@ module IBMWatson
|
|
2477
2531
|
|
2478
2532
|
headers = {
|
2479
2533
|
}
|
2534
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_audio"
|
2480
2535
|
|
2481
2536
|
method_url = "/v1/acoustic_customizations/%s/audio" % [ERB::Util.url_encode(customization_id)]
|
2482
2537
|
|
@@ -2629,6 +2684,7 @@ module IBMWatson
|
|
2629
2684
|
"Content-Type" => content_type,
|
2630
2685
|
"Contained-Content-Type" => contained_content_type
|
2631
2686
|
}
|
2687
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_audio"
|
2632
2688
|
|
2633
2689
|
params = {
|
2634
2690
|
"allow_overwrite" => allow_overwrite
|
@@ -2687,6 +2743,7 @@ module IBMWatson
|
|
2687
2743
|
|
2688
2744
|
headers = {
|
2689
2745
|
}
|
2746
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_audio"
|
2690
2747
|
|
2691
2748
|
method_url = "/v1/acoustic_customizations/%s/audio/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(audio_name)]
|
2692
2749
|
|
@@ -2724,6 +2781,7 @@ module IBMWatson
|
|
2724
2781
|
|
2725
2782
|
headers = {
|
2726
2783
|
}
|
2784
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_audio"
|
2727
2785
|
|
2728
2786
|
method_url = "/v1/acoustic_customizations/%s/audio/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(audio_name)]
|
2729
2787
|
|
@@ -2760,6 +2818,7 @@ module IBMWatson
|
|
2760
2818
|
|
2761
2819
|
headers = {
|
2762
2820
|
}
|
2821
|
+
headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_user_data"
|
2763
2822
|
|
2764
2823
|
params = {
|
2765
2824
|
"customer_id" => customer_id
|