ibm_watson 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ibm_watson/assistant_v1.rb +791 -736
- data/lib/ibm_watson/assistant_v2.rb +12 -8
- data/lib/ibm_watson/common.rb +2 -1
- data/lib/ibm_watson/compare_comply_v1.rb +171 -169
- data/lib/ibm_watson/discovery_v1.rb +778 -689
- data/lib/ibm_watson/language_translator_v3.rb +65 -63
- data/lib/ibm_watson/natural_language_classifier_v1.rb +36 -35
- data/lib/ibm_watson/natural_language_understanding_v1.rb +28 -25
- data/lib/ibm_watson/personality_insights_v3.rb +10 -10
- data/lib/ibm_watson/speech_to_text_v1.rb +764 -702
- data/lib/ibm_watson/text_to_speech_v1.rb +215 -200
- data/lib/ibm_watson/tone_analyzer_v3.rb +10 -9
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +94 -95
- data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +1 -1
- data/test/integration/test_assistant_v1.rb +18 -289
- data/test/integration/test_assistant_v2.rb +21 -31
- data/test/integration/test_discovery_v1.rb +21 -18
- data/test/integration/test_language_translator_v3.rb +3 -3
- data/test/integration/test_natural_language_classifier_v1.rb +3 -3
- data/test/integration/test_natural_language_understanding_v1.rb +16 -20
- data/test/integration/test_personality_insights_v3.rb +12 -40
- data/test/integration/test_speech_to_text_v1.rb +3 -3
- data/test/integration/test_text_to_speech_v1.rb +3 -3
- data/test/integration/test_tone_analyzer_v3.rb +14 -31
- data/test/integration/test_visual_recognition_v3.rb +3 -3
- data/test/unit/test_compare_comply_v1.rb +3 -7
- data/test/unit/test_discovery_v1.rb +21 -7
- data/test/unit/test_language_translator_v3.rb +1 -3
- data/test/unit/test_natural_language_classifier_v1.rb +1 -3
- data/test/unit/test_speech_to_text_v1.rb +25 -7
- data/test/unit/test_text_to_speech_v1.rb +0 -4
- data/test/unit/test_visual_recognition_v3.rb +2 -6
- metadata +2 -2
@@ -29,7 +29,6 @@
|
|
29
29
|
require "concurrent"
|
30
30
|
require "erb"
|
31
31
|
require "json"
|
32
|
-
|
33
32
|
require "ibm_cloud_sdk_core"
|
34
33
|
require_relative "./common.rb"
|
35
34
|
|
@@ -98,7 +97,7 @@ module IBMWatson
|
|
98
97
|
#########################
|
99
98
|
|
100
99
|
##
|
101
|
-
# @!method tone(tone_input:,
|
100
|
+
# @!method tone(tone_input:, sentences: nil, tones: nil, content_language: nil, accept_language: nil, content_type: nil)
|
102
101
|
# Analyze general tone.
|
103
102
|
# Use the general purpose endpoint to analyze the tone of your input content. The
|
104
103
|
# service analyzes the content for emotional and language tones. The method always
|
@@ -122,8 +121,6 @@ module IBMWatson
|
|
122
121
|
# endpoint](https://cloud.ibm.com/docs/services/tone-analyzer/using-tone.html#using-the-general-purpose-endpoint).
|
123
122
|
# @param tone_input [ToneInput] JSON, plain text, or HTML input that contains the content to be analyzed. For JSON
|
124
123
|
# input, provide an object of type `ToneInput`.
|
125
|
-
# @param content_type [String] The type of the input. A character encoding can be specified by including a
|
126
|
-
# `charset` parameter. For example, 'text/plain;charset=utf-8'.
|
127
124
|
# @param sentences [Boolean] Indicates whether the service is to return an analysis of each individual sentence
|
128
125
|
# in addition to its analysis of the full document. If `true` (the default), the
|
129
126
|
# service returns results for each sentence.
|
@@ -145,16 +142,19 @@ module IBMWatson
|
|
145
142
|
# variants are treated as their parent language; for example, `en-US` is interpreted
|
146
143
|
# as `en`. You can use different languages for **Content-Language** and
|
147
144
|
# **Accept-Language**.
|
145
|
+
# @param content_type [String] The type of the input. A character encoding can be specified by including a
|
146
|
+
# `charset` parameter. For example, 'text/plain;charset=utf-8'.
|
148
147
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
149
|
-
def tone(tone_input:,
|
148
|
+
def tone(tone_input:, sentences: nil, tones: nil, content_language: nil, accept_language: nil, content_type: nil)
|
150
149
|
raise ArgumentError.new("tone_input must be provided") if tone_input.nil?
|
151
150
|
|
152
151
|
headers = {
|
153
|
-
"Content-Type" => content_type,
|
154
152
|
"Content-Language" => content_language,
|
155
|
-
"Accept-Language" => accept_language
|
153
|
+
"Accept-Language" => accept_language,
|
154
|
+
"Content-Type" => content_type
|
156
155
|
}
|
157
|
-
|
156
|
+
sdk_headers = Common.new.get_sdk_headers("tone_analyzer", "V3", "tone")
|
157
|
+
headers.merge!(sdk_headers)
|
158
158
|
|
159
159
|
params = {
|
160
160
|
"version" => @version,
|
@@ -219,7 +219,8 @@ module IBMWatson
|
|
219
219
|
"Content-Language" => content_language,
|
220
220
|
"Accept-Language" => accept_language
|
221
221
|
}
|
222
|
-
|
222
|
+
sdk_headers = Common.new.get_sdk_headers("tone_analyzer", "V3", "tone_chat")
|
223
|
+
headers.merge!(sdk_headers)
|
223
224
|
|
224
225
|
params = {
|
225
226
|
"version" => @version
|
data/lib/ibm_watson/version.rb
CHANGED
@@ -21,7 +21,6 @@
|
|
21
21
|
require "concurrent"
|
22
22
|
require "erb"
|
23
23
|
require "json"
|
24
|
-
|
25
24
|
require "ibm_cloud_sdk_core"
|
26
25
|
require_relative "./common.rb"
|
27
26
|
|
@@ -78,33 +77,33 @@ module IBMWatson
|
|
78
77
|
#########################
|
79
78
|
|
80
79
|
##
|
81
|
-
# @!method classify(images_file: nil,
|
80
|
+
# @!method classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
|
82
81
|
# Classify images.
|
83
82
|
# Classify images with built-in or custom classifiers.
|
84
|
-
# @param images_file [File] An image file (.jpg, .png) or .zip file with images. Maximum image
|
85
|
-
# Include no more than 20 images and limit the .zip file to 100 MB.
|
86
|
-
# and .zip file names in UTF-8 if they contain non-ASCII
|
87
|
-
# assumes UTF-8 encoding if it encounters non-ASCII
|
83
|
+
# @param images_file [File] An image file (.gif, .jpg, .png, .tif) or .zip file with images. Maximum image
|
84
|
+
# size is 10 MB. Include no more than 20 images and limit the .zip file to 100 MB.
|
85
|
+
# Encode the image and .zip file names in UTF-8 if they contain non-ASCII
|
86
|
+
# characters. The service assumes UTF-8 encoding if it encounters non-ASCII
|
87
|
+
# characters.
|
88
88
|
#
|
89
89
|
# You can also include an image with the **url** parameter.
|
90
|
-
# @param
|
91
|
-
# @param
|
92
|
-
#
|
93
|
-
#
|
90
|
+
# @param images_filename [String] The filename for images_file.
|
91
|
+
# @param images_file_content_type [String] The content type of images_file.
|
92
|
+
# @param url [String] The URL of an image (.gif, .jpg, .png, .tif) to analyze. The minimum recommended
|
93
|
+
# pixel density is 32X32 pixels, but the service tends to perform better with images
|
94
|
+
# that are at least 224 x 224 pixels. The maximum image size is 10 MB.
|
94
95
|
#
|
95
96
|
# You can also include images with the **images_file** parameter.
|
96
97
|
# @param threshold [Float] The minimum score a class must have to be displayed in the response. Set the
|
97
|
-
# threshold to `0.0` to
|
98
|
-
# @param owners [Array[String]] The categories of classifiers to apply.
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
# The **classifier_ids** parameter overrides **owners**, so make sure that
|
107
|
-
# **classifier_ids** is empty.
|
98
|
+
# threshold to `0.0` to return all identified classes.
|
99
|
+
# @param owners [Array[String]] The categories of classifiers to apply. The **classifier_ids** parameter overrides
|
100
|
+
# **owners**, so make sure that **classifier_ids** is empty.
|
101
|
+
# - Use `IBM` to classify against the `default` general classifier. You get the same
|
102
|
+
# result if both **classifier_ids** and **owners** parameters are empty.
|
103
|
+
# - Use `me` to classify against all your custom classifiers. However, for better
|
104
|
+
# performance use **classifier_ids** to specify the specific custom classifiers to
|
105
|
+
# apply.
|
106
|
+
# - Use both `IBM` and `me` to analyze the image against both classifier categories.
|
108
107
|
# @param classifier_ids [Array[String]] Which classifiers to apply. Overrides the **owners** parameter. You can specify
|
109
108
|
# both custom and built-in classifier IDs. The built-in `default` classifier is used
|
110
109
|
# if both **classifier_ids** and **owners** parameters are empty.
|
@@ -113,14 +112,14 @@ module IBMWatson
|
|
113
112
|
# - `default`: Returns classes from thousands of general tags.
|
114
113
|
# - `food`: Enhances specificity and accuracy for images of food items.
|
115
114
|
# - `explicit`: Evaluates whether the image might be pornographic.
|
116
|
-
# @param
|
117
|
-
# @param images_filename [String] The filename for images_file.
|
115
|
+
# @param accept_language [String] The desired language of parts of the response. See the response for details.
|
118
116
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
119
|
-
def classify(images_file: nil,
|
117
|
+
def classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
|
120
118
|
headers = {
|
121
119
|
"Accept-Language" => accept_language
|
122
120
|
}
|
123
|
-
|
121
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "classify")
|
122
|
+
headers.merge!(sdk_headers)
|
124
123
|
|
125
124
|
params = {
|
126
125
|
"version" => @version
|
@@ -164,7 +163,7 @@ module IBMWatson
|
|
164
163
|
#########################
|
165
164
|
|
166
165
|
##
|
167
|
-
# @!method detect_faces(images_file: nil,
|
166
|
+
# @!method detect_faces(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, accept_language: nil)
|
168
167
|
# Detect faces in images.
|
169
168
|
# **Important:** On April 2, 2018, the identity information in the response to calls
|
170
169
|
# to the Face model was removed. The identity information refers to the `name` of
|
@@ -187,21 +186,22 @@ module IBMWatson
|
|
187
186
|
# characters.
|
188
187
|
#
|
189
188
|
# You can also include an image with the **url** parameter.
|
189
|
+
# @param images_filename [String] The filename for images_file.
|
190
|
+
# @param images_file_content_type [String] The content type of images_file.
|
190
191
|
# @param url [String] The URL of an image to analyze. Must be in .gif, .jpg, .png, or .tif format. The
|
191
192
|
# minimum recommended pixel density is 32X32 pixels, but the service tends to
|
192
193
|
# perform better with images that are at least 224 x 224 pixels. The maximum image
|
193
194
|
# size is 10 MB. Redirects are followed, so you can use a shortened URL.
|
194
195
|
#
|
195
196
|
# You can also include images with the **images_file** parameter.
|
196
|
-
# @param images_file_content_type [String] The content type of images_file.
|
197
|
-
# @param images_filename [String] The filename for images_file.
|
198
197
|
# @param accept_language [String] The desired language of parts of the response. See the response for details.
|
199
198
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
200
|
-
def detect_faces(images_file: nil,
|
199
|
+
def detect_faces(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, accept_language: nil)
|
201
200
|
headers = {
|
202
201
|
"Accept-Language" => accept_language
|
203
202
|
}
|
204
|
-
|
203
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "detect_faces")
|
204
|
+
headers.merge!(sdk_headers)
|
205
205
|
|
206
206
|
params = {
|
207
207
|
"version" => @version
|
@@ -236,7 +236,7 @@ module IBMWatson
|
|
236
236
|
#########################
|
237
237
|
|
238
238
|
##
|
239
|
-
# @!method create_classifier(name:, positive_examples:, negative_examples: nil,
|
239
|
+
# @!method create_classifier(name:, positive_examples:, negative_examples: nil, negative_examples_filename: nil)
|
240
240
|
# Create a classifier.
|
241
241
|
# Train a new multi-faceted classifier on the uploaded image data. Create your
|
242
242
|
# custom classifier with positive or negative examples. Include at least two sets of
|
@@ -247,7 +247,7 @@ module IBMWatson
|
|
247
247
|
# file names, and classifier and class names). The service assumes UTF-8 encoding if
|
248
248
|
# it encounters non-ASCII characters.
|
249
249
|
# @param name [String] The name of the new classifier. Encode special characters in UTF-8.
|
250
|
-
# @param positive_examples [
|
250
|
+
# @param positive_examples [File] A .zip file of images that depict the visual subject of a class in the new
|
251
251
|
# classifier. You can include more than one positive example file in a call.
|
252
252
|
#
|
253
253
|
# Specify the parameter name by appending `_positive_examples` to the class name.
|
@@ -263,20 +263,18 @@ module IBMWatson
|
|
263
263
|
# of the new classifier. Must contain a minimum of 10 images.
|
264
264
|
#
|
265
265
|
# Encode special characters in the file name in UTF-8.
|
266
|
-
# @param positive_examples_filename [Hash] The filename for positive_examples.
|
267
266
|
# @param negative_examples_filename [String] The filename for negative_examples.
|
268
267
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
269
|
-
def create_classifier(name:, positive_examples:, negative_examples: nil,
|
268
|
+
def create_classifier(name:, positive_examples:, negative_examples: nil, negative_examples_filename: nil)
|
270
269
|
raise ArgumentError.new("name must be provided") if name.nil?
|
271
270
|
|
272
271
|
raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.is_a?(Hash)
|
273
272
|
raise ArgumentError.new("positive_examples must have at least one hash entry") if positive_examples.empty?
|
274
273
|
|
275
|
-
raise ArgumentError.new("positive_examples_filename must be a hash") unless positive_examples_filename.nil? || positive_examples_filename.is_a?(Hash)
|
276
|
-
|
277
274
|
headers = {
|
278
275
|
}
|
279
|
-
|
276
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "create_classifier")
|
277
|
+
headers.merge!(sdk_headers)
|
280
278
|
|
281
279
|
params = {
|
282
280
|
"version" => @version
|
@@ -291,8 +289,7 @@ module IBMWatson
|
|
291
289
|
unless value.instance_of?(StringIO) || value.instance_of?(File)
|
292
290
|
value = value.respond_to?(:to_json) ? StringIO.new(value.to_json) : StringIO.new(value)
|
293
291
|
end
|
294
|
-
filename =
|
295
|
-
filename = value.path if filename.nil? && value.respond_to?(:path)
|
292
|
+
filename = value.path if value.respond_to?(:path)
|
296
293
|
form_data[part_name.to_sym] = HTTP::FormData::File.new(value, content_type: "application/octet-stream", filename: filename)
|
297
294
|
end
|
298
295
|
|
@@ -318,31 +315,32 @@ module IBMWatson
|
|
318
315
|
end
|
319
316
|
|
320
317
|
##
|
321
|
-
# @!method
|
322
|
-
#
|
323
|
-
# @param
|
324
|
-
#
|
325
|
-
|
326
|
-
|
318
|
+
# @!method delete_classifier(classifier_id:)
|
319
|
+
# Delete a classifier.
|
320
|
+
# @param classifier_id [String] The ID of the classifier.
|
321
|
+
# @return [nil]
|
322
|
+
def delete_classifier(classifier_id:)
|
323
|
+
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
324
|
+
|
327
325
|
headers = {
|
328
326
|
}
|
329
|
-
|
327
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "delete_classifier")
|
328
|
+
headers.merge!(sdk_headers)
|
330
329
|
|
331
330
|
params = {
|
332
|
-
"version" => @version
|
333
|
-
"verbose" => verbose
|
331
|
+
"version" => @version
|
334
332
|
}
|
335
333
|
|
336
|
-
method_url = "/v3/classifiers"
|
334
|
+
method_url = "/v3/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
|
337
335
|
|
338
|
-
|
339
|
-
method: "
|
336
|
+
request(
|
337
|
+
method: "DELETE",
|
340
338
|
url: method_url,
|
341
339
|
headers: headers,
|
342
340
|
params: params,
|
343
341
|
accept_json: true
|
344
342
|
)
|
345
|
-
|
343
|
+
nil
|
346
344
|
end
|
347
345
|
|
348
346
|
##
|
@@ -356,7 +354,8 @@ module IBMWatson
|
|
356
354
|
|
357
355
|
headers = {
|
358
356
|
}
|
359
|
-
|
357
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "get_classifier")
|
358
|
+
headers.merge!(sdk_headers)
|
360
359
|
|
361
360
|
params = {
|
362
361
|
"version" => @version
|
@@ -375,11 +374,40 @@ module IBMWatson
|
|
375
374
|
end
|
376
375
|
|
377
376
|
##
|
378
|
-
# @!method
|
377
|
+
# @!method list_classifiers(verbose: nil)
|
378
|
+
# Retrieve a list of classifiers.
|
379
|
+
# @param verbose [Boolean] Specify `true` to return details about the classifiers. Omit this parameter to
|
380
|
+
# return a brief list of classifiers.
|
381
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
382
|
+
def list_classifiers(verbose: nil)
|
383
|
+
headers = {
|
384
|
+
}
|
385
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "list_classifiers")
|
386
|
+
headers.merge!(sdk_headers)
|
387
|
+
|
388
|
+
params = {
|
389
|
+
"version" => @version,
|
390
|
+
"verbose" => verbose
|
391
|
+
}
|
392
|
+
|
393
|
+
method_url = "/v3/classifiers"
|
394
|
+
|
395
|
+
response = request(
|
396
|
+
method: "GET",
|
397
|
+
url: method_url,
|
398
|
+
headers: headers,
|
399
|
+
params: params,
|
400
|
+
accept_json: true
|
401
|
+
)
|
402
|
+
response
|
403
|
+
end
|
404
|
+
|
405
|
+
##
|
406
|
+
# @!method update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
|
379
407
|
# Update a classifier.
|
380
|
-
# Update a custom classifier by adding new positive or negative classes
|
381
|
-
#
|
382
|
-
#
|
408
|
+
# Update a custom classifier by adding new positive or negative classes or by adding
|
409
|
+
# new images to existing classes. You must supply at least one set of positive or
|
410
|
+
# negative examples. For details, see [Updating custom
|
383
411
|
# classifiers](https://cloud.ibm.com/docs/services/visual-recognition/customizing.html#updating-custom-classifiers).
|
384
412
|
#
|
385
413
|
# Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image
|
@@ -391,7 +419,7 @@ module IBMWatson
|
|
391
419
|
# previous requests. The retrained property shows the last time the classifier
|
392
420
|
# retraining finished.
|
393
421
|
# @param classifier_id [String] The ID of the classifier.
|
394
|
-
# @param positive_examples [
|
422
|
+
# @param positive_examples [File] A .zip file of images that depict the visual subject of a class in the classifier.
|
395
423
|
# The positive examples create or update classes in the classifier. You can include
|
396
424
|
# more than one positive example file in a call.
|
397
425
|
#
|
@@ -408,19 +436,17 @@ module IBMWatson
|
|
408
436
|
# of the new classifier. Must contain a minimum of 10 images.
|
409
437
|
#
|
410
438
|
# Encode special characters in the file name in UTF-8.
|
411
|
-
# @param positive_examples_filename [Hash] The filename for positive_examples.
|
412
439
|
# @param negative_examples_filename [String] The filename for negative_examples.
|
413
440
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
414
|
-
def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil,
|
441
|
+
def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
|
415
442
|
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
416
443
|
|
417
444
|
raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.nil? || positive_examples.is_a?(Hash)
|
418
445
|
|
419
|
-
raise ArgumentError.new("positive_examples_filename must be a hash") unless positive_examples_filename.nil? || positive_examples_filename.is_a?(Hash)
|
420
|
-
|
421
446
|
headers = {
|
422
447
|
}
|
423
|
-
|
448
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "update_classifier")
|
449
|
+
headers.merge!(sdk_headers)
|
424
450
|
|
425
451
|
params = {
|
426
452
|
"version" => @version
|
@@ -433,8 +459,7 @@ module IBMWatson
|
|
433
459
|
unless value.instance_of?(StringIO) || value.instance_of?(File)
|
434
460
|
value = value.respond_to?(:to_json) ? StringIO.new(value.to_json) : StringIO.new(value)
|
435
461
|
end
|
436
|
-
filename =
|
437
|
-
filename = value.path if filename.nil? && value.respond_to?(:path)
|
462
|
+
filename = value.path if value.respond_to?(:path)
|
438
463
|
form_data[part_name.to_sym] = HTTP::FormData::File.new(value, content_type: "application/octet-stream", filename: filename)
|
439
464
|
end
|
440
465
|
|
@@ -458,34 +483,6 @@ module IBMWatson
|
|
458
483
|
)
|
459
484
|
response
|
460
485
|
end
|
461
|
-
|
462
|
-
##
|
463
|
-
# @!method delete_classifier(classifier_id:)
|
464
|
-
# Delete a classifier.
|
465
|
-
# @param classifier_id [String] The ID of the classifier.
|
466
|
-
# @return [nil]
|
467
|
-
def delete_classifier(classifier_id:)
|
468
|
-
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
469
|
-
|
470
|
-
headers = {
|
471
|
-
}
|
472
|
-
headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "delete_classifier")
|
473
|
-
|
474
|
-
params = {
|
475
|
-
"version" => @version
|
476
|
-
}
|
477
|
-
|
478
|
-
method_url = "/v3/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
|
479
|
-
|
480
|
-
request(
|
481
|
-
method: "DELETE",
|
482
|
-
url: method_url,
|
483
|
-
headers: headers,
|
484
|
-
params: params,
|
485
|
-
accept_json: true
|
486
|
-
)
|
487
|
-
nil
|
488
|
-
end
|
489
486
|
#########################
|
490
487
|
# Core ML
|
491
488
|
#########################
|
@@ -502,7 +499,8 @@ module IBMWatson
|
|
502
499
|
|
503
500
|
headers = {
|
504
501
|
}
|
505
|
-
|
502
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "get_core_ml_model")
|
503
|
+
headers.merge!(sdk_headers)
|
506
504
|
|
507
505
|
params = {
|
508
506
|
"version" => @version
|
@@ -540,7 +538,8 @@ module IBMWatson
|
|
540
538
|
|
541
539
|
headers = {
|
542
540
|
}
|
543
|
-
|
541
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "delete_user_data")
|
542
|
+
headers.merge!(sdk_headers)
|
544
543
|
|
545
544
|
params = {
|
546
545
|
"version" => @version,
|
@@ -53,7 +53,7 @@ class WebSocketClient
|
|
53
53
|
end
|
54
54
|
elsif json_object.key?("results") || json_object.key?("speaker_labels")
|
55
55
|
hypothesis = ""
|
56
|
-
unless json_object["results"].nil?
|
56
|
+
unless json_object["results"].nil? && json_object["speaker_labels"].nil?
|
57
57
|
hypothesis = json_object.dig("results", 0, "alternatives", 0, "transcript")
|
58
58
|
b_final = json_object.dig("results", 0, "final")
|
59
59
|
transcripts = extract_transcripts(alternatives: json_object.dig("results", 0, "alternatives"))
|