ibm_watson 0.1.0 → 0.1.1
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 +3 -2
- data/bin/console +1 -0
- data/lib/ibm_watson/iam_token_manager.rb +7 -7
- data/lib/ibm_watson/version.rb +3 -1
- data/lib/ibm_watson/watson_service.rb +2 -2
- data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +3 -3
- data/rakefile +1 -1
- data/test/integration/test_assistant_v1.rb +640 -638
- data/test/integration/test_discovery_v1.rb +173 -170
- data/test/integration/test_iam_assistant_v1.rb +674 -672
- data/test/integration/test_language_translator_v3.rb +68 -66
- data/test/integration/test_natural_language_classifier_v1.rb +57 -55
- data/test/integration/test_natural_language_understanding_v1.rb +89 -87
- data/test/integration/test_personality_insights_v3.rb +87 -85
- data/test/integration/test_speech_to_text_v1.rb +143 -142
- data/test/integration/test_text_to_speech_v1.rb +71 -69
- data/test/integration/test_tone_analyzer_v3.rb +65 -63
- data/test/integration/test_visual_recognition_v3.rb +53 -51
- data/test/test_helper.rb +0 -1
- metadata +4 -18
@@ -4,61 +4,63 @@ require("json")
|
|
4
4
|
require_relative("./../test_helper.rb")
|
5
5
|
require("minitest/hooks/test")
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
7
|
+
unless ENV["VISUAL_RECOGNITION_IAM_APIKEY"].nil? || ENV["VISUAL_RECOGNITION_IAM_URL"].nil?
|
8
|
+
# Integration tests for the Visual Recognition V3 Service
|
9
|
+
class VisualRecognitionV3Test < Minitest::Test
|
10
|
+
include Minitest::Hooks
|
11
|
+
attr_accessor :service, :classifier_id
|
12
|
+
def before_all
|
13
|
+
@service = IBMWatson::VisualRecognitionV3.new(
|
14
|
+
iam_api_key: ENV["VISUAL_RECOGNITION_IAM_APIKEY"],
|
15
|
+
version: "2018-03-19",
|
16
|
+
url: ENV["VISUAL_RECOGNITION_IAM_URL"]
|
17
|
+
)
|
18
|
+
@classifier_id = "doxnotxdeletexsdksxintegration_718351350"
|
19
|
+
@service.add_default_headers(
|
20
|
+
headers: {
|
21
|
+
"X-Watson-Learning-Opt-Out" => "1",
|
22
|
+
"X-Watson-Test" => "1"
|
23
|
+
}
|
24
|
+
)
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
def test_classify
|
28
|
+
image_file = File.open(Dir.getwd + "/resources/dog.jpg")
|
29
|
+
dog_results = @service.classify(
|
30
|
+
images_file: image_file,
|
31
|
+
threshold: "0.1",
|
32
|
+
classifier_ids: "default"
|
33
|
+
).result
|
34
|
+
refute(dog_results.nil?)
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
def test_detect_faces
|
38
|
+
output = @service.detect_faces(
|
39
|
+
url: "https://www.ibm.com/ibm/ginni/images/ginni_bio_780x981_v4_03162016.jpg"
|
40
|
+
).result
|
41
|
+
refute(output.nil?)
|
42
|
+
end
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
def test_custom_classifier
|
45
|
+
skip "Time Consuming"
|
46
|
+
cars = File.open(Dir.getwd + "/resources/cars.zip")
|
47
|
+
trucks = File.open(Dir.getwd + "/resources/trucks.zip")
|
48
|
+
classifier = @service.create_classifier(
|
49
|
+
name: "CarsVsTrucks",
|
50
|
+
classname_positive_examples: cars,
|
51
|
+
negative_examples: trucks
|
52
|
+
).result
|
53
|
+
refute(classifier.nil?)
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
classifier_id = classifier["classifier_id"]
|
56
|
+
output = @service.get_classifier(
|
57
|
+
classifier_id: classifier_id
|
58
|
+
).result
|
59
|
+
refute(output.nil?)
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
@service.delete_classifier(
|
62
|
+
classifier_id: classifier_id
|
63
|
+
)
|
64
|
+
end
|
63
65
|
end
|
64
66
|
end
|
data/test/test_helper.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.1
|
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-07-
|
11
|
+
date: 2018-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.3'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: json
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.1'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.1'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: bundler
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -287,7 +273,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
273
|
requirements:
|
288
274
|
- - ">="
|
289
275
|
- !ruby/object:Gem::Version
|
290
|
-
version: '
|
276
|
+
version: '2.3'
|
291
277
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
278
|
requirements:
|
293
279
|
- - ">="
|
@@ -298,5 +284,5 @@ rubyforge_project:
|
|
298
284
|
rubygems_version: 2.7.7
|
299
285
|
signing_key:
|
300
286
|
specification_version: 4
|
301
|
-
summary:
|
287
|
+
summary: Official client library to use the IBM Watson Services
|
302
288
|
test_files: []
|