ibm_watson 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b55686114aadfb84334751c7e31f29944e2993349a8445d76d6cd4bc671bcec9
4
- data.tar.gz: 18c1223dc6035601ece235203b2bc0d2e4f0f7eb44f7122fdb388e9de8d066d6
3
+ metadata.gz: 2339230f5cc6e45ede3db381b47265019e10fee0cb9147b0a5fc6e6f4bb216ff
4
+ data.tar.gz: 313d1675f687555eca475a7ad1e072b44c40fcee95f4c3efa0286ca9c027e4f9
5
5
  SHA512:
6
- metadata.gz: 88ef64f14a15d3c87039f12829bac1e0e8083da880a5f67cb7c01be9c05f18f070637ebf5ee0d9b35554a951db0fe2b5ceab6612d774c95772afd47596fa4fe1
7
- data.tar.gz: fb3bd6d9032fb8209ca473ffb047017f778e690378e383898cdc285a6034f1a4f5b9c5ec21d28e3016630252a4f34f6062da1cc4b022baf80adc1338f3bfa6ca
6
+ metadata.gz: 7826f822275d6e8f0806ad3f78a00801482d33bd2dff674f9e29512abdd4104fc6cc567fd3fd909b40a089819e96bdae987036685655267e07e53d9db69c6a14
7
+ data.tar.gz: 3017550a16f71a9a772b1f07a70643ddfbc72077ef37c7abea729bdf48b6088b552ffcc6b80be81fb8e569706a82b0812b66f70ab0b1074316947610c6bed301
@@ -328,6 +328,7 @@ module IBMWatson
328
328
  headers = {
329
329
  "Content-Type" => content_type
330
330
  }
331
+ keywords *= "," unless keywords.nil?
331
332
  params = {
332
333
  "model" => model,
333
334
  "language_customization_id" => language_customization_id,
@@ -335,7 +336,7 @@ module IBMWatson
335
336
  "base_model_version" => base_model_version,
336
337
  "customization_weight" => customization_weight,
337
338
  "inactivity_timeout" => inactivity_timeout,
338
- "keywords" => keywords.to_a,
339
+ "keywords" => keywords,
339
340
  "keywords_threshold" => keywords_threshold,
340
341
  "max_alternatives" => max_alternatives,
341
342
  "word_alternatives_threshold" => word_alternatives_threshold,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IBMWatson
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
  end
@@ -69,6 +69,37 @@ if !ENV["SPEECH_TO_TEXT_USERNAME"].nil? && !ENV["SPEECH_TO_TEXT_PASSWORD"].nil?
69
69
  refute_nil(output["results"][0]["alternatives"][0]["transcript"])
70
70
  end
71
71
 
72
+ def test_recognize_with_keywords
73
+ file = File.open(Dir.getwd + "/resources/speech.wav")
74
+ File.open(file) do |audio_file|
75
+ output = @service.recognize(
76
+ audio: audio_file,
77
+ content_type: "audio/l16; rate=44100",
78
+ timestamps: true,
79
+ word_alternatives_threshold: 0.9,
80
+ keywords: %w"[colorado tornado]",
81
+ keywords_threshold: 0.5
82
+ )
83
+ refute_nil(output.result["results"][0]["alternatives"][0]["transcript"])
84
+ end
85
+ end
86
+
87
+ def test_recognize_with_single_keyword
88
+ file = File.open(Dir.getwd + "/resources/speech.wav")
89
+ output = nil
90
+ File.open(file) do |audio_file|
91
+ output = @service.recognize(
92
+ audio: audio_file,
93
+ content_type: "audio/l16; rate=44100",
94
+ timestamps: true,
95
+ word_alternatives_threshold: 0.9,
96
+ keywords: %w"[colorado]",
97
+ keywords_threshold: 0.5
98
+ )
99
+ refute_nil(output.result["results"][0]["alternatives"][0]["transcript"])
100
+ end
101
+ end
102
+
72
103
  def test_recognize_async
73
104
  audio_file = File.open(Dir.getwd + "/resources/speech.wav")
74
105
  future = @service.async.recognize(
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.9.1
4
+ version: 0.9.2
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-11-20 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby