ibm_watson 0.8.0 → 0.9.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 +2 -0
- data/lib/ibm_watson/discovery_v1.rb +92 -0
- data/lib/ibm_watson/natural_language_understanding_v1.rb +10 -53
- data/lib/ibm_watson/speech_to_text_v1.rb +140 -104
- data/lib/ibm_watson/version.rb +1 -1
- data/test/unit/test_discovery_v1.rb +58 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eb3dece96d55c7c9cf48e0e2e85912e1b044710c6483f7f39c1993c9e7ce0ed
|
4
|
+
data.tar.gz: db5d372a1e33c321f3c4e0156d777513909872e48b87d81e0a5eadbb661ef30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7af1ca50217a8900f58b4599aafd28e7f376283f631a4e99fef5bae499e47a0315af2b573e99fb08377f00d0f33a6c2ac2b4ab50b69633d1f785c7bc9482d3d
|
7
|
+
data.tar.gz: daa066a5ff004c629c069d123619fa6e1da2074af5e5d0323cc824d41bce9c34c07209a74be159ba737976c37ab095dd32c43257723dbb0f99a2aa52016a9332
|
data/README.md
CHANGED
@@ -35,6 +35,8 @@ Ruby gem to quickly get started with the various [IBM Watson][wdc] services.
|
|
35
35
|
## Before you begin
|
36
36
|
* You need an [IBM Cloud][ibm-cloud-onboarding] account.
|
37
37
|
|
38
|
+
> Watson Assistant v2 API is released in beta. For details, see the ["Introducing Watson Assistant"](https://www.ibm.com/blogs/watson/2018/03/the-future-of-watson-conversation-watson-assistant/) blog post.
|
39
|
+
|
38
40
|
## Installation
|
39
41
|
|
40
42
|
Install the gem:
|
@@ -838,6 +838,98 @@ module IBMWatson
|
|
838
838
|
)
|
839
839
|
nil
|
840
840
|
end
|
841
|
+
|
842
|
+
##
|
843
|
+
# @!method get_tokenization_dictionary_status(environment_id:, collection_id:)
|
844
|
+
# Get tokenization dictionary status.
|
845
|
+
# Returns the current status of the tokenization dictionary for the specified
|
846
|
+
# collection.
|
847
|
+
# @param environment_id [String] The ID of the environment.
|
848
|
+
# @param collection_id [String] The ID of the collection.
|
849
|
+
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
850
|
+
def get_tokenization_dictionary_status(environment_id:, collection_id:)
|
851
|
+
raise ArgumentError("environment_id must be provided") if environment_id.nil?
|
852
|
+
|
853
|
+
raise ArgumentError("collection_id must be provided") if collection_id.nil?
|
854
|
+
|
855
|
+
headers = {
|
856
|
+
}
|
857
|
+
params = {
|
858
|
+
"version" => @version
|
859
|
+
}
|
860
|
+
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
861
|
+
response = request(
|
862
|
+
method: "GET",
|
863
|
+
url: method_url,
|
864
|
+
headers: headers,
|
865
|
+
params: params,
|
866
|
+
accept_json: true
|
867
|
+
)
|
868
|
+
response
|
869
|
+
end
|
870
|
+
|
871
|
+
##
|
872
|
+
# @!method create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
|
873
|
+
# Create tokenization dictionary.
|
874
|
+
# Upload a custom tokenization dictionary to use with the specified collection.
|
875
|
+
# @param environment_id [String] The ID of the environment.
|
876
|
+
# @param collection_id [String] The ID of the collection.
|
877
|
+
# @param tokenization_rules [Array[TokenDictRule]] An array of tokenization rules. Each rule contains, the original `text` string,
|
878
|
+
# component `tokens`, any alternate character set `readings`, and which
|
879
|
+
# `part_of_speech` the text is from.
|
880
|
+
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
881
|
+
def create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
|
882
|
+
raise ArgumentError("environment_id must be provided") if environment_id.nil?
|
883
|
+
|
884
|
+
raise ArgumentError("collection_id must be provided") if collection_id.nil?
|
885
|
+
|
886
|
+
headers = {
|
887
|
+
}
|
888
|
+
params = {
|
889
|
+
"version" => @version
|
890
|
+
}
|
891
|
+
data = {
|
892
|
+
"tokenization_rules" => tokenization_rules
|
893
|
+
}
|
894
|
+
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
895
|
+
response = request(
|
896
|
+
method: "POST",
|
897
|
+
url: method_url,
|
898
|
+
headers: headers,
|
899
|
+
params: params,
|
900
|
+
json: data,
|
901
|
+
accept_json: true
|
902
|
+
)
|
903
|
+
response
|
904
|
+
end
|
905
|
+
|
906
|
+
##
|
907
|
+
# @!method delete_tokenization_dictionary(environment_id:, collection_id:)
|
908
|
+
# Delete tokenization dictionary.
|
909
|
+
# Delete the tokenization dictionary from the collection.
|
910
|
+
# @param environment_id [String] The ID of the environment.
|
911
|
+
# @param collection_id [String] The ID of the collection.
|
912
|
+
# @return [nil]
|
913
|
+
def delete_tokenization_dictionary(environment_id:, collection_id:)
|
914
|
+
raise ArgumentError("environment_id must be provided") if environment_id.nil?
|
915
|
+
|
916
|
+
raise ArgumentError("collection_id must be provided") if collection_id.nil?
|
917
|
+
|
918
|
+
headers = {
|
919
|
+
}
|
920
|
+
params = {
|
921
|
+
"version" => @version
|
922
|
+
}
|
923
|
+
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
924
|
+
request(
|
925
|
+
method: "DELETE",
|
926
|
+
url: method_url,
|
927
|
+
headers: headers,
|
928
|
+
params: params,
|
929
|
+
accept_json: true
|
930
|
+
)
|
931
|
+
nil
|
932
|
+
end
|
841
933
|
#########################
|
842
934
|
# Documents
|
843
935
|
#########################
|
@@ -15,14 +15,14 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
# Analyze various features of text content at scale. Provide text, raw HTML, or a public
|
18
|
-
# URL
|
19
|
-
#
|
20
|
-
#
|
18
|
+
# URL and IBM Watson Natural Language Understanding will give you results for the features
|
19
|
+
# you request. The service cleans HTML content before analysis by default, so the results
|
20
|
+
# can ignore most advertisements and other unwanted content.
|
21
21
|
#
|
22
|
-
# You can create
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
22
|
+
# You can create [custom
|
23
|
+
# models](/docs/services/natural-language-understanding/customizing.html) with Watson
|
24
|
+
# Knowledge Studio to detect custom entities and relations in Natural Language
|
25
|
+
# Understanding.
|
26
26
|
|
27
27
|
require "concurrent"
|
28
28
|
require "erb"
|
@@ -97,52 +97,9 @@ module IBMWatson
|
|
97
97
|
##
|
98
98
|
# @!method 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)
|
99
99
|
# Analyze text, HTML, or a public webpage.
|
100
|
-
# Analyzes text, HTML, or a public webpage with one or more text analysis features
|
101
|
-
#
|
102
|
-
#
|
103
|
-
# Identify general concepts that are referenced or alluded to in your content.
|
104
|
-
# Concepts that are detected typically have an associated link to a DBpedia
|
105
|
-
# resource.
|
106
|
-
#
|
107
|
-
# ### Emotion
|
108
|
-
# Detect anger, disgust, fear, joy, or sadness that is conveyed by your content.
|
109
|
-
# Emotion information can be returned for detected entities, keywords, or
|
110
|
-
# user-specified target phrases found in the text.
|
111
|
-
#
|
112
|
-
# ### Entities
|
113
|
-
# Detect important people, places, geopolitical entities and other types of entities
|
114
|
-
# in your content. Entity detection recognizes consecutive coreferences of each
|
115
|
-
# entity. For example, analysis of the following text would count \"Barack Obama\"
|
116
|
-
# and \"He\" as the same entity:
|
117
|
-
#
|
118
|
-
# \"Barack Obama was the 44th President of the United States. He took office in
|
119
|
-
# January 2009.\"
|
120
|
-
#
|
121
|
-
# ### Keywords
|
122
|
-
# Determine the most important keywords in your content. Keyword phrases are
|
123
|
-
# organized by relevance in the results.
|
124
|
-
#
|
125
|
-
# ### Metadata
|
126
|
-
# Get author information, publication date, and the title of your text/HTML content.
|
127
|
-
#
|
128
|
-
# ### Relations
|
129
|
-
# Recognize when two entities are related, and identify the type of relation. For
|
130
|
-
# example, you can identify an \"awardedTo\" relation between an award and its
|
131
|
-
# recipient.
|
132
|
-
#
|
133
|
-
# ### Semantic Roles
|
134
|
-
# Parse sentences into subject-action-object form, and identify entities and
|
135
|
-
# keywords that are subjects or objects of an action.
|
136
|
-
#
|
137
|
-
# ### Sentiment
|
138
|
-
# Determine whether your content conveys postive or negative sentiment. Sentiment
|
139
|
-
# information can be returned for detected entities, keywords, or user-specified
|
140
|
-
# target phrases found in the text.
|
141
|
-
#
|
142
|
-
# ### Categories
|
143
|
-
# Categorize your content into a hierarchical 5-level taxonomy. For example,
|
144
|
-
# \"Leonardo DiCaprio won an Oscar\" returns \"/art and entertainment/movies and
|
145
|
-
# tv/movies\" as the most confident classification.
|
100
|
+
# Analyzes text, HTML, or a public webpage with one or more text analysis features,
|
101
|
+
# including categories, concepts, emotion, entities, keywords, metadata, relations,
|
102
|
+
# semantic roles, and sentiment.
|
146
103
|
# @param features [Features] Specific features to analyze the document for.
|
147
104
|
# @param text [String] The plain text to analyze. One of the `text`, `html`, or `url` parameters is
|
148
105
|
# required.
|
@@ -24,8 +24,8 @@
|
|
24
24
|
# For speech recognition, the service supports synchronous and asynchronous HTTP
|
25
25
|
# Representational State Transfer (REST) interfaces. It also supports a WebSocket
|
26
26
|
# interface that provides a full-duplex, low-latency communication channel: Clients send
|
27
|
-
# requests and audio to the service and receive results over a single connection
|
28
|
-
#
|
27
|
+
# requests and audio to the service and receive results over a single connection
|
28
|
+
# asynchronously.
|
29
29
|
#
|
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
|
@@ -146,14 +146,13 @@ module IBMWatson
|
|
146
146
|
#########################
|
147
147
|
|
148
148
|
##
|
149
|
-
# @!method recognize(audio:, content_type:, model: nil,
|
149
|
+
# @!method recognize(audio:, content_type:, 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)
|
150
150
|
# Recognize audio.
|
151
151
|
# Sends audio and returns transcription results for a recognition request. Returns
|
152
152
|
# only the final results; to enable interim results, use the WebSocket API. The
|
153
153
|
# service imposes a data size limit of 100 MB. It automatically detects the
|
154
154
|
# endianness of the incoming audio and, for audio that includes multiple channels,
|
155
|
-
# downmixes the audio to one-channel mono during transcoding.
|
156
|
-
# format, you can specify the endianness.)
|
155
|
+
# downmixes the audio to one-channel mono during transcoding.
|
157
156
|
#
|
158
157
|
# **See also:** [Making a basic HTTP
|
159
158
|
# request](https://console.bluemix.net/docs/services/speech-to-text/http.html#HTTP-basic).
|
@@ -178,16 +177,23 @@ module IBMWatson
|
|
178
177
|
#
|
179
178
|
# ### Audio formats (content types)
|
180
179
|
#
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
# * `
|
180
|
+
# The service accepts audio in the following formats (MIME types).
|
181
|
+
# * For formats that are labeled **Required**, you must use the `Content-Type`
|
182
|
+
# header with the request to specify the format of the audio.
|
183
|
+
# * For all other formats, you can omit the `Content-Type` header or specify
|
184
|
+
# `application/octet-stream` with the header to have the service automatically
|
185
|
+
# detect the format of the audio. (With the `curl` command, you can specify either
|
186
|
+
# `\"Content-Type:\"` or `\"Content-Type: application/octet-stream\"`.)
|
187
|
+
#
|
188
|
+
# Where indicated, the format that you specify must include the sampling rate and
|
189
|
+
# can optionally include the number of channels and the endianness of the audio.
|
190
|
+
# * `audio/basic` (**Required.** Use only with narrowband models.)
|
185
191
|
# * `audio/flac`
|
186
|
-
# * `audio/l16` (Specify the sampling rate (`rate`) and optionally the
|
187
|
-
# channels (`channels`) and endianness (`endianness`) of the audio.)
|
192
|
+
# * `audio/l16` (**Required.** Specify the sampling rate (`rate`) and optionally the
|
193
|
+
# number of channels (`channels`) and endianness (`endianness`) of the audio.)
|
188
194
|
# * `audio/mp3`
|
189
195
|
# * `audio/mpeg`
|
190
|
-
# * `audio/mulaw` (Specify the sampling rate (`rate`) of the audio.)
|
196
|
+
# * `audio/mulaw` (**Required.** Specify the sampling rate (`rate`) of the audio.)
|
191
197
|
# * `audio/ogg` (The service automatically detects the codec of the input audio.)
|
192
198
|
# * `audio/ogg;codecs=opus`
|
193
199
|
# * `audio/ogg;codecs=vorbis`
|
@@ -200,6 +206,9 @@ module IBMWatson
|
|
200
206
|
# formats](https://console.bluemix.net/docs/services/speech-to-text/audio-formats.html).
|
201
207
|
#
|
202
208
|
#
|
209
|
+
# **Note:** You must pass a content type when using any of the Watson SDKs. The SDKs
|
210
|
+
# require the content-type parameter for all audio formats.
|
211
|
+
#
|
203
212
|
# ### Multipart speech recognition
|
204
213
|
#
|
205
214
|
# The method also supports multipart recognition requests. With multipart requests,
|
@@ -214,15 +223,19 @@ module IBMWatson
|
|
214
223
|
#
|
215
224
|
# **See also:** [Making a multipart HTTP
|
216
225
|
# request](https://console.bluemix.net/docs/services/speech-to-text/http.html#HTTP-multi).
|
217
|
-
# @param audio [String] The audio to transcribe
|
226
|
+
# @param audio [String] The audio to transcribe.
|
218
227
|
# @param content_type [String] The type of the input.
|
219
228
|
# @param model [String] The identifier of the model that is to be used for the recognition request.
|
220
|
-
# @param
|
229
|
+
# @param language_customization_id [String] The customization ID (GUID) of a custom language model that is to be used with the
|
221
230
|
# recognition request. The base model of the specified custom language model must
|
222
231
|
# match the model specified with the `model` parameter. You must make the request
|
223
232
|
# with service credentials created for the instance of the service that owns the
|
224
233
|
# custom model. By default, no custom language model is used. See [Custom
|
225
234
|
# models](https://console.bluemix.net/docs/services/speech-to-text/input.html#custom).
|
235
|
+
#
|
236
|
+
#
|
237
|
+
# **Note:** Use this parameter instead of the deprecated `customization_id`
|
238
|
+
# parameter.
|
226
239
|
# @param acoustic_customization_id [String] The customization ID (GUID) of a custom acoustic model that is to be used with the
|
227
240
|
# recognition request. The base model of the specified custom acoustic model must
|
228
241
|
# match the model specified with the `model` parameter. You must make the request
|
@@ -305,8 +318,11 @@ module IBMWatson
|
|
305
318
|
# method and check that the attribute `speaker_labels` is set to `true`. See
|
306
319
|
# [Speaker
|
307
320
|
# labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
|
321
|
+
# @param customization_id [String] **Deprecated.** Use the `language_customization_id` parameter to specify the
|
322
|
+
# customization ID (GUID) of a custom language model that is to be used with the
|
323
|
+
# recognition request. Do not specify both parameters with a request.
|
308
324
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
309
|
-
def recognize(audio:, content_type:, model: nil,
|
325
|
+
def recognize(audio:, content_type:, 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)
|
310
326
|
raise ArgumentError("audio must be provided") if audio.nil?
|
311
327
|
|
312
328
|
raise ArgumentError("content_type must be provided") if content_type.nil?
|
@@ -316,7 +332,7 @@ module IBMWatson
|
|
316
332
|
}
|
317
333
|
params = {
|
318
334
|
"model" => model,
|
319
|
-
"
|
335
|
+
"language_customization_id" => language_customization_id,
|
320
336
|
"acoustic_customization_id" => acoustic_customization_id,
|
321
337
|
"base_model_version" => base_model_version,
|
322
338
|
"customization_weight" => customization_weight,
|
@@ -329,7 +345,8 @@ module IBMWatson
|
|
329
345
|
"timestamps" => timestamps,
|
330
346
|
"profanity_filter" => profanity_filter,
|
331
347
|
"smart_formatting" => smart_formatting,
|
332
|
-
"speaker_labels" => speaker_labels
|
348
|
+
"speaker_labels" => speaker_labels,
|
349
|
+
"customization_id" => customization_id
|
333
350
|
}
|
334
351
|
data = audio
|
335
352
|
method_url = "/v1/recognize"
|
@@ -583,7 +600,7 @@ module IBMWatson
|
|
583
600
|
end
|
584
601
|
|
585
602
|
##
|
586
|
-
# @!method create_job(audio:, content_type:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil,
|
603
|
+
# @!method create_job(audio:, content_type:, 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)
|
587
604
|
# Create a job.
|
588
605
|
# Creates a job for a new asynchronous recognition request. The job is owned by the
|
589
606
|
# user whose service credentials are used to create it. How you learn the status and
|
@@ -641,16 +658,23 @@ module IBMWatson
|
|
641
658
|
#
|
642
659
|
# ### Audio formats (content types)
|
643
660
|
#
|
644
|
-
#
|
645
|
-
#
|
646
|
-
#
|
647
|
-
# * `
|
661
|
+
# The service accepts audio in the following formats (MIME types).
|
662
|
+
# * For formats that are labeled **Required**, you must use the `Content-Type`
|
663
|
+
# header with the request to specify the format of the audio.
|
664
|
+
# * For all other formats, you can omit the `Content-Type` header or specify
|
665
|
+
# `application/octet-stream` with the header to have the service automatically
|
666
|
+
# detect the format of the audio. (With the `curl` command, you can specify either
|
667
|
+
# `\"Content-Type:\"` or `\"Content-Type: application/octet-stream\"`.)
|
668
|
+
#
|
669
|
+
# Where indicated, the format that you specify must include the sampling rate and
|
670
|
+
# can optionally include the number of channels and the endianness of the audio.
|
671
|
+
# * `audio/basic` (**Required.** Use only with narrowband models.)
|
648
672
|
# * `audio/flac`
|
649
|
-
# * `audio/l16` (Specify the sampling rate (`rate`) and optionally the
|
650
|
-
# channels (`channels`) and endianness (`endianness`) of the audio.)
|
673
|
+
# * `audio/l16` (**Required.** Specify the sampling rate (`rate`) and optionally the
|
674
|
+
# number of channels (`channels`) and endianness (`endianness`) of the audio.)
|
651
675
|
# * `audio/mp3`
|
652
676
|
# * `audio/mpeg`
|
653
|
-
# * `audio/mulaw` (Specify the sampling rate (`rate`) of the audio.)
|
677
|
+
# * `audio/mulaw` (**Required.** Specify the sampling rate (`rate`) of the audio.)
|
654
678
|
# * `audio/ogg` (The service automatically detects the codec of the input audio.)
|
655
679
|
# * `audio/ogg;codecs=opus`
|
656
680
|
# * `audio/ogg;codecs=vorbis`
|
@@ -661,7 +685,11 @@ module IBMWatson
|
|
661
685
|
#
|
662
686
|
# **See also:** [Audio
|
663
687
|
# formats](https://console.bluemix.net/docs/services/speech-to-text/audio-formats.html).
|
664
|
-
#
|
688
|
+
#
|
689
|
+
#
|
690
|
+
# **Note:** You must pass a content type when using any of the Watson SDKs. The SDKs
|
691
|
+
# require the content-type parameter for all audio formats.
|
692
|
+
# @param audio [String] The audio to transcribe.
|
665
693
|
# @param content_type [String] The type of the input.
|
666
694
|
# @param model [String] The identifier of the model that is to be used for the recognition request.
|
667
695
|
# @param callback_url [String] A URL to which callback notifications are to be sent. The URL must already be
|
@@ -698,12 +726,16 @@ module IBMWatson
|
|
698
726
|
# finished. If not delivered via a callback, the results must be retrieved within
|
699
727
|
# this time. Omit the parameter to use a time to live of one week. The parameter is
|
700
728
|
# valid with or without a callback URL.
|
701
|
-
# @param
|
729
|
+
# @param language_customization_id [String] The customization ID (GUID) of a custom language model that is to be used with the
|
702
730
|
# recognition request. The base model of the specified custom language model must
|
703
731
|
# match the model specified with the `model` parameter. You must make the request
|
704
732
|
# with service credentials created for the instance of the service that owns the
|
705
733
|
# custom model. By default, no custom language model is used. See [Custom
|
706
734
|
# models](https://console.bluemix.net/docs/services/speech-to-text/input.html#custom).
|
735
|
+
#
|
736
|
+
#
|
737
|
+
# **Note:** Use this parameter instead of the deprecated `customization_id`
|
738
|
+
# parameter.
|
707
739
|
# @param acoustic_customization_id [String] The customization ID (GUID) of a custom acoustic model that is to be used with the
|
708
740
|
# recognition request. The base model of the specified custom acoustic model must
|
709
741
|
# match the model specified with the `model` parameter. You must make the request
|
@@ -786,8 +818,11 @@ module IBMWatson
|
|
786
818
|
# method and check that the attribute `speaker_labels` is set to `true`. See
|
787
819
|
# [Speaker
|
788
820
|
# labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
|
821
|
+
# @param customization_id [String] **Deprecated.** Use the `language_customization_id` parameter to specify the
|
822
|
+
# customization ID (GUID) of a custom language model that is to be used with the
|
823
|
+
# recognition request. Do not specify both parameters with a request.
|
789
824
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
790
|
-
def create_job(audio:, content_type:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil,
|
825
|
+
def create_job(audio:, content_type:, 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)
|
791
826
|
raise ArgumentError("audio must be provided") if audio.nil?
|
792
827
|
|
793
828
|
raise ArgumentError("content_type must be provided") if content_type.nil?
|
@@ -801,7 +836,7 @@ module IBMWatson
|
|
801
836
|
"events" => events,
|
802
837
|
"user_token" => user_token,
|
803
838
|
"results_ttl" => results_ttl,
|
804
|
-
"
|
839
|
+
"language_customization_id" => language_customization_id,
|
805
840
|
"acoustic_customization_id" => acoustic_customization_id,
|
806
841
|
"base_model_version" => base_model_version,
|
807
842
|
"customization_weight" => customization_weight,
|
@@ -814,7 +849,8 @@ module IBMWatson
|
|
814
849
|
"timestamps" => timestamps,
|
815
850
|
"profanity_filter" => profanity_filter,
|
816
851
|
"smart_formatting" => smart_formatting,
|
817
|
-
"speaker_labels" => speaker_labels
|
852
|
+
"speaker_labels" => speaker_labels,
|
853
|
+
"customization_id" => customization_id
|
818
854
|
}
|
819
855
|
data = audio
|
820
856
|
method_url = "/v1/recognitions"
|
@@ -873,7 +909,7 @@ module IBMWatson
|
|
873
909
|
#
|
874
910
|
# **See also:** [Checking the status and retrieving the results of a
|
875
911
|
# job](https://console.bluemix.net/docs/services/speech-to-text/async.html#job).
|
876
|
-
# @param id [String] The
|
912
|
+
# @param id [String] The identifier of the asynchronous job that is to be used for the request.
|
877
913
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
878
914
|
def check_job(id:)
|
879
915
|
raise ArgumentError("id must be provided") if id.nil?
|
@@ -901,7 +937,7 @@ module IBMWatson
|
|
901
937
|
#
|
902
938
|
# **See also:** [Deleting a
|
903
939
|
# job](https://console.bluemix.net/docs/services/speech-to-text/async.html#delete).
|
904
|
-
# @param id [String] The
|
940
|
+
# @param id [String] The identifier of the asynchronous job that is to be used for the request.
|
905
941
|
# @return [nil]
|
906
942
|
def delete_job(id:)
|
907
943
|
raise ArgumentError("id must be provided") if id.nil?
|
@@ -1020,9 +1056,9 @@ module IBMWatson
|
|
1020
1056
|
#
|
1021
1057
|
# **See also:** [Listing custom language
|
1022
1058
|
# models](https://console.bluemix.net/docs/services/speech-to-text/language-models.html#listModels).
|
1023
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1024
|
-
# request with service credentials created for the
|
1025
|
-
# the custom model.
|
1059
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1060
|
+
# the request. You must make the request with service credentials created for the
|
1061
|
+
# instance of the service that owns the custom model.
|
1026
1062
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1027
1063
|
def get_language_model(customization_id:)
|
1028
1064
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1049,9 +1085,9 @@ module IBMWatson
|
|
1049
1085
|
#
|
1050
1086
|
# **See also:** [Deleting a custom language
|
1051
1087
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-models.html#deleteModel).
|
1052
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1053
|
-
# request with service credentials created for the
|
1054
|
-
# the custom model.
|
1088
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1089
|
+
# the request. You must make the request with service credentials created for the
|
1090
|
+
# instance of the service that owns the custom model.
|
1055
1091
|
# @return [nil]
|
1056
1092
|
def delete_language_model(customization_id:)
|
1057
1093
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1100,9 +1136,9 @@ module IBMWatson
|
|
1100
1136
|
#
|
1101
1137
|
# **See also:** [Train the custom language
|
1102
1138
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-create.html#trainModel).
|
1103
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1104
|
-
# request with service credentials created for the
|
1105
|
-
# the custom model.
|
1139
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1140
|
+
# the request. You must make the request with service credentials created for the
|
1141
|
+
# instance of the service that owns the custom model.
|
1106
1142
|
# @param word_type_to_add [String] The type of words from the custom language model's words resource on which to
|
1107
1143
|
# train the model:
|
1108
1144
|
# * `all` (the default) trains the model on all new words, regardless of whether
|
@@ -1155,9 +1191,9 @@ module IBMWatson
|
|
1155
1191
|
#
|
1156
1192
|
# **See also:** [Resetting a custom language
|
1157
1193
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-models.html#resetModel).
|
1158
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1159
|
-
# request with service credentials created for the
|
1160
|
-
# the custom model.
|
1194
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1195
|
+
# the request. You must make the request with service credentials created for the
|
1196
|
+
# instance of the service that owns the custom model.
|
1161
1197
|
# @return [nil]
|
1162
1198
|
def reset_language_model(customization_id:)
|
1163
1199
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1195,9 +1231,9 @@ module IBMWatson
|
|
1195
1231
|
#
|
1196
1232
|
# **See also:** [Upgrading a custom language
|
1197
1233
|
# model](https://console.bluemix.net/docs/services/speech-to-text/custom-upgrade.html#upgradeLanguage).
|
1198
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1199
|
-
# request with service credentials created for the
|
1200
|
-
# the custom model.
|
1234
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1235
|
+
# the request. You must make the request with service credentials created for the
|
1236
|
+
# instance of the service that owns the custom model.
|
1201
1237
|
# @return [nil]
|
1202
1238
|
def upgrade_language_model(customization_id:)
|
1203
1239
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1227,9 +1263,9 @@ module IBMWatson
|
|
1227
1263
|
#
|
1228
1264
|
# **See also:** [Listing corpora for a custom language
|
1229
1265
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-corpora.html#listCorpora).
|
1230
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1231
|
-
# request with service credentials created for the
|
1232
|
-
# the custom model.
|
1266
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1267
|
+
# the request. You must make the request with service credentials created for the
|
1268
|
+
# instance of the service that owns the custom model.
|
1233
1269
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1234
1270
|
def list_corpora(customization_id:)
|
1235
1271
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1293,9 +1329,9 @@ module IBMWatson
|
|
1293
1329
|
# corpora](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#workingCorpora)
|
1294
1330
|
# * [Add corpora to the custom language
|
1295
1331
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-create.html#addCorpora).
|
1296
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1297
|
-
# request with service credentials created for the
|
1298
|
-
# the custom model.
|
1332
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1333
|
+
# the request. You must make the request with service credentials created for the
|
1334
|
+
# instance of the service that owns the custom model.
|
1299
1335
|
# @param corpus_name [String] The name of the new corpus for the custom language model. Use a localized name
|
1300
1336
|
# that matches the language of the custom model and reflects the contents of the
|
1301
1337
|
# corpus.
|
@@ -1306,8 +1342,8 @@ module IBMWatson
|
|
1306
1342
|
# words that are added or modified by the user.
|
1307
1343
|
# @param corpus_file [File] A plain text file that contains the training data for the corpus. Encode the file
|
1308
1344
|
# in UTF-8 if it contains non-ASCII characters; the service assumes UTF-8 encoding
|
1309
|
-
# if it encounters non-ASCII characters. With
|
1310
|
-
# to upload the file for the request.
|
1345
|
+
# if it encounters non-ASCII characters. With the `curl` command, use the
|
1346
|
+
# `--data-binary` option to upload the file for the request.
|
1311
1347
|
# @param allow_overwrite [Boolean] If `true`, the specified corpus or audio resource overwrites an existing corpus or
|
1312
1348
|
# audio resource with the same name. If `false`, the request fails if a corpus or
|
1313
1349
|
# audio resource with the same name already exists. The parameter has no effect if a
|
@@ -1359,9 +1395,9 @@ module IBMWatson
|
|
1359
1395
|
#
|
1360
1396
|
# **See also:** [Listing corpora for a custom language
|
1361
1397
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-corpora.html#listCorpora).
|
1362
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1363
|
-
# request with service credentials created for the
|
1364
|
-
# the custom model.
|
1398
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1399
|
+
# the request. You must make the request with service credentials created for the
|
1400
|
+
# instance of the service that owns the custom model.
|
1365
1401
|
# @param corpus_name [String] The name of the corpus for the custom language model.
|
1366
1402
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1367
1403
|
def get_corpus(customization_id:, corpus_name:)
|
@@ -1394,9 +1430,9 @@ module IBMWatson
|
|
1394
1430
|
#
|
1395
1431
|
# **See also:** [Deleting a corpus from a custom language
|
1396
1432
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-corpora.html#deleteCorpus).
|
1397
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1398
|
-
# request with service credentials created for the
|
1399
|
-
# the custom model.
|
1433
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1434
|
+
# the request. You must make the request with service credentials created for the
|
1435
|
+
# instance of the service that owns the custom model.
|
1400
1436
|
# @param corpus_name [String] The name of the corpus for the custom language model.
|
1401
1437
|
# @return [nil]
|
1402
1438
|
def delete_corpus(customization_id:, corpus_name:)
|
@@ -1432,9 +1468,9 @@ module IBMWatson
|
|
1432
1468
|
#
|
1433
1469
|
# **See also:** [Listing words from a custom language
|
1434
1470
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-words.html#listWords).
|
1435
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1436
|
-
# request with service credentials created for the
|
1437
|
-
# the custom model.
|
1471
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1472
|
+
# the request. You must make the request with service credentials created for the
|
1473
|
+
# instance of the service that owns the custom model.
|
1438
1474
|
# @param word_type [String] The type of words to be listed from the custom language model's words resource:
|
1439
1475
|
# * `all` (the default) shows all words.
|
1440
1476
|
# * `user` shows only custom words that were added or modified by the user.
|
@@ -1445,7 +1481,7 @@ module IBMWatson
|
|
1445
1481
|
# are sorted in ascending alphabetical order. For alphabetical ordering, the
|
1446
1482
|
# lexicographical precedence is numeric values, uppercase letters, and lowercase
|
1447
1483
|
# letters. For count ordering, values with the same count are ordered
|
1448
|
-
# alphabetically. With
|
1484
|
+
# alphabetically. With the `curl` command, URL encode the `+` symbol as `%2B`.
|
1449
1485
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1450
1486
|
def list_words(customization_id:, word_type: nil, sort: nil)
|
1451
1487
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1527,9 +1563,9 @@ module IBMWatson
|
|
1527
1563
|
# words](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#workingWords)
|
1528
1564
|
# * [Add words to the custom language
|
1529
1565
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-create.html#addWords).
|
1530
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1531
|
-
# request with service credentials created for the
|
1532
|
-
# the custom model.
|
1566
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1567
|
+
# the request. You must make the request with service credentials created for the
|
1568
|
+
# instance of the service that owns the custom model.
|
1533
1569
|
# @param words [Array[CustomWord]] An array of objects that provides information about each custom word that is to be
|
1534
1570
|
# added to or updated in the custom language model.
|
1535
1571
|
# @return [nil]
|
@@ -1595,9 +1631,9 @@ module IBMWatson
|
|
1595
1631
|
# words](https://console.bluemix.net/docs/services/speech-to-text/language-resource.html#workingWords)
|
1596
1632
|
# * [Add words to the custom language
|
1597
1633
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-create.html#addWords).
|
1598
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1599
|
-
# request with service credentials created for the
|
1600
|
-
# the custom model.
|
1634
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1635
|
+
# the request. You must make the request with service credentials created for the
|
1636
|
+
# instance of the service that owns the custom model.
|
1601
1637
|
# @param word_name [String] The custom word for the custom language model. When you add or update a custom
|
1602
1638
|
# word with the **Add a custom word** method, do not include spaces in the word. Use
|
1603
1639
|
# a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
|
@@ -1654,9 +1690,9 @@ module IBMWatson
|
|
1654
1690
|
#
|
1655
1691
|
# **See also:** [Listing words from a custom language
|
1656
1692
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-words.html#listWords).
|
1657
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1658
|
-
# request with service credentials created for the
|
1659
|
-
# the custom model.
|
1693
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1694
|
+
# the request. You must make the request with service credentials created for the
|
1695
|
+
# instance of the service that owns the custom model.
|
1660
1696
|
# @param word_name [String] The custom word for the custom language model. When you add or update a custom
|
1661
1697
|
# word with the **Add a custom word** method, do not include spaces in the word. Use
|
1662
1698
|
# a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
|
@@ -1691,9 +1727,9 @@ module IBMWatson
|
|
1691
1727
|
#
|
1692
1728
|
# **See also:** [Deleting a word from a custom language
|
1693
1729
|
# model](https://console.bluemix.net/docs/services/speech-to-text/language-words.html#deleteWord).
|
1694
|
-
# @param customization_id [String] The customization ID (GUID) of the custom language model
|
1695
|
-
# request with service credentials created for the
|
1696
|
-
# the custom model.
|
1730
|
+
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
|
1731
|
+
# the request. You must make the request with service credentials created for the
|
1732
|
+
# instance of the service that owns the custom model.
|
1697
1733
|
# @param word_name [String] The custom word for the custom language model. When you add or update a custom
|
1698
1734
|
# word with the **Add a custom word** method, do not include spaces in the word. Use
|
1699
1735
|
# a `-` (dash) or `_` (underscore) to connect the tokens of compound words.
|
@@ -1804,9 +1840,9 @@ module IBMWatson
|
|
1804
1840
|
#
|
1805
1841
|
# **See also:** [Listing custom acoustic
|
1806
1842
|
# models](https://console.bluemix.net/docs/services/speech-to-text/acoustic-models.html#listModels).
|
1807
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
1808
|
-
# request with service credentials created for the
|
1809
|
-
# the custom model.
|
1843
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1844
|
+
# the request. You must make the request with service credentials created for the
|
1845
|
+
# instance of the service that owns the custom model.
|
1810
1846
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
1811
1847
|
def get_acoustic_model(customization_id:)
|
1812
1848
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1833,9 +1869,9 @@ module IBMWatson
|
|
1833
1869
|
#
|
1834
1870
|
# **See also:** [Deleting a custom acoustic
|
1835
1871
|
# model](https://console.bluemix.net/docs/services/speech-to-text/acoustic-models.html#deleteModel).
|
1836
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
1837
|
-
# request with service credentials created for the
|
1838
|
-
# the custom model.
|
1872
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1873
|
+
# the request. You must make the request with service credentials created for the
|
1874
|
+
# instance of the service that owns the custom model.
|
1839
1875
|
# @return [nil]
|
1840
1876
|
def delete_acoustic_model(customization_id:)
|
1841
1877
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1894,9 +1930,9 @@ module IBMWatson
|
|
1894
1930
|
#
|
1895
1931
|
# **See also:** [Train the custom acoustic
|
1896
1932
|
# model](https://console.bluemix.net/docs/services/speech-to-text/acoustic-create.html#trainModel).
|
1897
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
1898
|
-
# request with service credentials created for the
|
1899
|
-
# the custom model.
|
1933
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1934
|
+
# the request. You must make the request with service credentials created for the
|
1935
|
+
# instance of the service that owns the custom model.
|
1900
1936
|
# @param custom_language_model_id [String] The customization ID (GUID) of a custom language model that is to be used during
|
1901
1937
|
# training of the custom acoustic model. Specify a custom language model that has
|
1902
1938
|
# been trained with verbatim transcriptions of the audio resources or that contains
|
@@ -1932,9 +1968,9 @@ module IBMWatson
|
|
1932
1968
|
#
|
1933
1969
|
# **See also:** [Resetting a custom acoustic
|
1934
1970
|
# model](https://console.bluemix.net/docs/services/speech-to-text/acoustic-models.html#resetModel).
|
1935
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
1936
|
-
# request with service credentials created for the
|
1937
|
-
# the custom model.
|
1971
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
1972
|
+
# the request. You must make the request with service credentials created for the
|
1973
|
+
# instance of the service that owns the custom model.
|
1938
1974
|
# @return [nil]
|
1939
1975
|
def reset_acoustic_model(customization_id:)
|
1940
1976
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -1979,9 +2015,9 @@ module IBMWatson
|
|
1979
2015
|
#
|
1980
2016
|
# **See also:** [Upgrading a custom acoustic
|
1981
2017
|
# model](https://console.bluemix.net/docs/services/speech-to-text/custom-upgrade.html#upgradeAcoustic).
|
1982
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
1983
|
-
# request with service credentials created for the
|
1984
|
-
# the custom model.
|
2018
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2019
|
+
# the request. You must make the request with service credentials created for the
|
2020
|
+
# instance of the service that owns the custom model.
|
1985
2021
|
# @param custom_language_model_id [String] If the custom acoustic model was trained with a custom language model, the
|
1986
2022
|
# customization ID (GUID) of that custom language model. The custom language model
|
1987
2023
|
# must be upgraded before the custom acoustic model can be upgraded.
|
@@ -2020,9 +2056,9 @@ module IBMWatson
|
|
2020
2056
|
#
|
2021
2057
|
# **See also:** [Listing audio resources for a custom acoustic
|
2022
2058
|
# model](https://console.bluemix.net/docs/services/speech-to-text/acoustic-audio.html#listAudio).
|
2023
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
2024
|
-
# request with service credentials created for the
|
2025
|
-
# the custom model.
|
2059
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2060
|
+
# the request. You must make the request with service credentials created for the
|
2061
|
+
# instance of the service that owns the custom model.
|
2026
2062
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
2027
2063
|
def list_audio(customization_id:)
|
2028
2064
|
raise ArgumentError("customization_id must be provided") if customization_id.nil?
|
@@ -2139,9 +2175,9 @@ module IBMWatson
|
|
2139
2175
|
# * Do not include spaces, slashes, or backslashes in the file name.
|
2140
2176
|
# * Do not use the name of an audio file that has already been added to the custom
|
2141
2177
|
# model as part of an archive-type resource.
|
2142
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
2143
|
-
# request with service credentials created for the
|
2144
|
-
# the custom model.
|
2178
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2179
|
+
# the request. You must make the request with service credentials created for the
|
2180
|
+
# instance of the service that owns the custom model.
|
2145
2181
|
# @param audio_name [String] The name of the new audio resource for the custom acoustic model. Use a localized
|
2146
2182
|
# name that matches the language of the custom model and reflects the contents of
|
2147
2183
|
# the resource.
|
@@ -2217,9 +2253,9 @@ module IBMWatson
|
|
2217
2253
|
#
|
2218
2254
|
# **See also:** [Listing audio resources for a custom acoustic
|
2219
2255
|
# model](https://console.bluemix.net/docs/services/speech-to-text/acoustic-audio.html#listAudio).
|
2220
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
2221
|
-
# request with service credentials created for the
|
2222
|
-
# the custom model.
|
2256
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2257
|
+
# the request. You must make the request with service credentials created for the
|
2258
|
+
# instance of the service that owns the custom model.
|
2223
2259
|
# @param audio_name [String] The name of the audio resource for the custom acoustic model.
|
2224
2260
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
2225
2261
|
def get_audio(customization_id:, audio_name:)
|
@@ -2252,9 +2288,9 @@ module IBMWatson
|
|
2252
2288
|
#
|
2253
2289
|
# **See also:** [Deleting an audio resource from a custom acoustic
|
2254
2290
|
# model](https://console.bluemix.net/docs/services/speech-to-text/acoustic-audio.html#deleteAudio).
|
2255
|
-
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model
|
2256
|
-
# request with service credentials created for the
|
2257
|
-
# the custom model.
|
2291
|
+
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
|
2292
|
+
# the request. You must make the request with service credentials created for the
|
2293
|
+
# instance of the service that owns the custom model.
|
2258
2294
|
# @param audio_name [String] The name of the audio resource for the custom acoustic model.
|
2259
2295
|
# @return [nil]
|
2260
2296
|
def delete_audio(customization_id:, audio_name:)
|
data/lib/ibm_watson/version.rb
CHANGED
@@ -906,6 +906,63 @@ class DiscoveryV1Test < Minitest::Test
|
|
906
906
|
assert_nil(service_response)
|
907
907
|
end
|
908
908
|
|
909
|
+
def test_tokenization_dictionary
|
910
|
+
service = IBMWatson::DiscoveryV1.new(
|
911
|
+
username: "username",
|
912
|
+
password: "password",
|
913
|
+
version: "2018-03-05"
|
914
|
+
)
|
915
|
+
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
|
916
|
+
.with(
|
917
|
+
headers: {
|
918
|
+
"Accept" => "application/json",
|
919
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
920
|
+
"Host" => "gateway.watsonplatform.net"
|
921
|
+
}
|
922
|
+
).to_return(status: 200, body: { tokenization_dictionary: "results" }.to_json, headers: { "Content-Type" => "application/json" })
|
923
|
+
service_response = service.get_tokenization_dictionary_status(
|
924
|
+
environment_id: "envid",
|
925
|
+
collection_id: "collid"
|
926
|
+
)
|
927
|
+
assert_equal({ "tokenization_dictionary" => "results" }, service_response.result)
|
928
|
+
|
929
|
+
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
|
930
|
+
.with(
|
931
|
+
body: "{\"tokenization_rules\":[{\"rule1\":\"messi\",\"rule2\":\"ronaldo\"}]}",
|
932
|
+
headers: {
|
933
|
+
"Accept" => "application/json",
|
934
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
935
|
+
"Content-Type" => "application/json",
|
936
|
+
"Host" => "gateway.watsonplatform.net"
|
937
|
+
}
|
938
|
+
).to_return(status: 200, body: { discription: "success" }.to_json, headers: { "Content-Type" => "application/json" })
|
939
|
+
service_response = service.create_tokenization_dictionary(
|
940
|
+
environment_id: "envid",
|
941
|
+
collection_id: "collid",
|
942
|
+
tokenization_rules: [
|
943
|
+
{
|
944
|
+
"rule1" => "messi",
|
945
|
+
"rule2" => "ronaldo"
|
946
|
+
}
|
947
|
+
]
|
948
|
+
)
|
949
|
+
assert_equal({ "discription" => "success" }, service_response.result)
|
950
|
+
|
951
|
+
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
|
952
|
+
.with(
|
953
|
+
headers: {
|
954
|
+
"Accept" => "application/json",
|
955
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
956
|
+
"Host" => "gateway.watsonplatform.net"
|
957
|
+
}
|
958
|
+
).to_return(status: 200, body: { description: "success" }.to_json, headers: { "Content-Type" => "application/json" })
|
959
|
+
service_response = service.delete_tokenization_dictionary(
|
960
|
+
environment_id: "envid",
|
961
|
+
collection_id: "collid"
|
962
|
+
)
|
963
|
+
assert_nil(service_response)
|
964
|
+
end
|
965
|
+
|
909
966
|
def test_delete_user_data
|
910
967
|
service = IBMWatson::DiscoveryV1.new(
|
911
968
|
username: "username",
|
@@ -955,7 +1012,7 @@ class DiscoveryV1Test < Minitest::Test
|
|
955
1012
|
)
|
956
1013
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/query?&version=2018-03-05")
|
957
1014
|
.with(
|
958
|
-
body:
|
1015
|
+
body: "{\"collection_ids\":[\"collid\"]}",
|
959
1016
|
headers: {
|
960
1017
|
"Accept" => "application/json",
|
961
1018
|
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm_watson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Nussbaum
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|