ibm_watson 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,8 @@
30
30
  # one or more words that, when combined, sound like the word. A phonetic translation is
31
31
  # based on the SSML phoneme format for representing a word. You can specify a phonetic
32
32
  # translation in standard International Phonetic Alphabet (IPA) representation or in the
33
- # proprietary IBM Symbolic Phonetic Representation (SPR).
33
+ # proprietary IBM Symbolic Phonetic Representation (SPR). The Arabic, Chinese, Dutch, and
34
+ # Korean languages support only IPA.
34
35
 
35
36
  require "concurrent"
36
37
  require "erb"
@@ -44,6 +45,8 @@ module IBMWatson
44
45
  # The Text to Speech V1 service.
45
46
  class TextToSpeechV1 < IBMCloudSdkCore::BaseService
46
47
  include Concurrent::Async
48
+ DEFAULT_SERVICE_NAME = "text_to_speech"
49
+ DEFAULT_SERVICE_URL = "https://stream.watsonplatform.net/text-to-speech/api"
47
50
  ##
48
51
  # @!method initialize(args)
49
52
  # Construct a new client for the Text to Speech service.
@@ -52,15 +55,19 @@ module IBMWatson
52
55
  # @option args service_url [String] The base service URL to use when contacting the service.
53
56
  # The base service_url may differ between IBM Cloud regions.
54
57
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
58
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
59
+ # any external configuration, if applicable.
55
60
  def initialize(args = {})
56
61
  @__async_initialized__ = false
57
62
  defaults = {}
58
- defaults[:service_url] = "https://stream.watsonplatform.net/text-to-speech/api"
63
+ defaults[:service_url] = DEFAULT_SERVICE_URL
64
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
59
65
  defaults[:authenticator] = nil
66
+ user_service_url = args[:service_url] unless args[:service_url].nil?
60
67
  args = defaults.merge(args)
61
- args[:service_name] = "text_to_speech"
62
68
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
63
69
  super
70
+ @service_url = user_service_url unless user_service_url.nil?
64
71
  end
65
72
 
66
73
  #########################
@@ -216,10 +223,10 @@ module IBMWatson
216
223
  # description.
217
224
  # @param voice [String] The voice to use for synthesis.
218
225
  # @param customization_id [String] The customization ID (GUID) of a custom voice model to use for the synthesis. If a
219
- # custom voice model is specified, it is guaranteed to work only if it matches the
220
- # language of the indicated voice. You must make the request with credentials for
221
- # the instance of the service that owns the custom model. Omit the parameter to use
222
- # the specified voice with no customization.
226
+ # custom voice model is specified, it works only if it matches the language of the
227
+ # indicated voice. You must make the request with credentials for the instance of
228
+ # the service that owns the custom model. Omit the parameter to use the specified
229
+ # voice with no customization.
223
230
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
224
231
  def synthesize(text:, accept: nil, voice: nil, customization_id: nil)
225
232
  raise ArgumentError.new("text must be provided") if text.nil?
@@ -263,8 +270,7 @@ module IBMWatson
263
270
  # specific voice to see the default translation for the language of that voice or
264
271
  # for a specific custom voice model to see the translation for that voice model.
265
272
  #
266
- # **Note:** This method is currently a beta release. The method does not support the
267
- # Arabic, Chinese, and Dutch languages.
273
+ # **Note:** This method is currently a beta release.
268
274
  #
269
275
  # **See also:** [Querying a word from a
270
276
  # language](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryLanguage).
@@ -272,8 +278,9 @@ module IBMWatson
272
278
  # @param voice [String] A voice that specifies the language in which the pronunciation is to be returned.
273
279
  # All voices for the same language (for example, `en-US`) return the same
274
280
  # translation.
275
- # @param format [String] The phoneme format in which to return the pronunciation. Omit the parameter to
276
- # obtain the pronunciation in the default format.
281
+ # @param format [String] The phoneme format in which to return the pronunciation. The Arabic, Chinese,
282
+ # Dutch, and Korean languages support only IPA. Omit the parameter to obtain the
283
+ # pronunciation in the default format.
277
284
  # @param customization_id [String] The customization ID (GUID) of a custom voice model for which the pronunciation is
278
285
  # to be returned. The language of a specified custom model must match the language
279
286
  # of the specified voice. If the word is not defined in the specified custom model,
@@ -320,14 +327,15 @@ module IBMWatson
320
327
  # model. The model is owned by the instance of the service whose credentials are
321
328
  # used to create it.
322
329
  #
323
- # **Note:** This method is currently a beta release. The service does not support
324
- # voice model customization for the Arabic, Chinese, and Dutch languages.
330
+ # **Note:** This method is currently a beta release.
325
331
  #
326
332
  # **See also:** [Creating a custom
327
333
  # model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels#cuModelsCreate).
328
334
  # @param name [String] The name of the new custom voice model.
329
- # @param language [String] The language of the new custom voice model. Omit the parameter to use the the
330
- # default language, `en-US`.
335
+ # @param language [String] The language of the new custom voice model. You create a custom voice model for a
336
+ # specific language, not for a specific voice. A custom model can be used with any
337
+ # voice, standard or neural, for its specified language. Omit the parameter to use
338
+ # the the default language, `en-US`.
331
339
  # @param description [String] A description of the new custom voice model. Specifying a description is
332
340
  # recommended.
333
341
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
@@ -673,8 +681,9 @@ module IBMWatson
673
681
  # @param word [String] The word that is to be added or updated for the custom voice model.
674
682
  # @param translation [String] The phonetic or sounds-like translation for the word. A phonetic translation is
675
683
  # based on the SSML format for representing the phonetic string of a word either as
676
- # an IPA translation or as an IBM SPR translation. A sounds-like is one or more
677
- # words that, when combined, sound like the word.
684
+ # an IPA translation or as an IBM SPR translation. The Arabic, Chinese, Dutch, and
685
+ # Korean languages support only IPA. A sounds-like is one or more words that, when
686
+ # combined, sound like the word.
678
687
  # @param part_of_speech [String] **Japanese only.** The part of speech for the word. The service uses the value to
679
688
  # produce the correct intonation for the word. You can create only a single entry,
680
689
  # with or without a single part of speech, for any word; you cannot create multiple
@@ -38,6 +38,8 @@ module IBMWatson
38
38
  # The Tone Analyzer V3 service.
39
39
  class ToneAnalyzerV3 < IBMCloudSdkCore::BaseService
40
40
  include Concurrent::Async
41
+ DEFAULT_SERVICE_NAME = "tone_analyzer"
42
+ DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/tone-analyzer/api"
41
43
  ##
42
44
  # @!method initialize(args)
43
45
  # Construct a new client for the Tone Analyzer service.
@@ -56,19 +58,23 @@ module IBMWatson
56
58
  # @option args service_url [String] The base service URL to use when contacting the service.
57
59
  # The base service_url may differ between IBM Cloud regions.
58
60
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
61
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
62
+ # any external configuration, if applicable.
59
63
  def initialize(args = {})
60
64
  @__async_initialized__ = false
61
65
  defaults = {}
62
66
  defaults[:version] = nil
63
- defaults[:service_url] = "https://gateway.watsonplatform.net/tone-analyzer/api"
67
+ defaults[:service_url] = DEFAULT_SERVICE_URL
68
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
64
69
  defaults[:authenticator] = nil
70
+ user_service_url = args[:service_url] unless args[:service_url].nil?
65
71
  args = defaults.merge(args)
66
72
  @version = args[:version]
67
73
  raise ArgumentError.new("version must be provided") if @version.nil?
68
74
 
69
- args[:service_name] = "tone_analyzer"
70
75
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
71
76
  super
77
+ @service_url = user_service_url unless user_service_url.nil?
72
78
  end
73
79
 
74
80
  #########################
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IBMWatson
4
- VERSION = "1.3.1"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -30,6 +30,8 @@ module IBMWatson
30
30
  # The Visual Recognition V3 service.
31
31
  class VisualRecognitionV3 < IBMCloudSdkCore::BaseService
32
32
  include Concurrent::Async
33
+ DEFAULT_SERVICE_NAME = "visual_recognition"
34
+ DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/visual-recognition/api"
33
35
  ##
34
36
  # @!method initialize(args)
35
37
  # Construct a new client for the Visual Recognition service.
@@ -48,19 +50,23 @@ module IBMWatson
48
50
  # @option args service_url [String] The base service URL to use when contacting the service.
49
51
  # The base service_url may differ between IBM Cloud regions.
50
52
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
53
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
54
+ # any external configuration, if applicable.
51
55
  def initialize(args = {})
52
56
  @__async_initialized__ = false
53
57
  defaults = {}
54
58
  defaults[:version] = nil
55
- defaults[:service_url] = "https://gateway.watsonplatform.net/visual-recognition/api"
59
+ defaults[:service_url] = DEFAULT_SERVICE_URL
60
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
56
61
  defaults[:authenticator] = nil
62
+ user_service_url = args[:service_url] unless args[:service_url].nil?
57
63
  args = defaults.merge(args)
58
64
  @version = args[:version]
59
65
  raise ArgumentError.new("version must be provided") if @version.nil?
60
66
 
61
- args[:service_name] = "visual_recognition"
62
67
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
63
68
  super
69
+ @service_url = user_service_url unless user_service_url.nil?
64
70
  end
65
71
 
66
72
  #########################
@@ -29,6 +29,8 @@ module IBMWatson
29
29
  # The Visual Recognition V4 service.
30
30
  class VisualRecognitionV4 < IBMCloudSdkCore::BaseService
31
31
  include Concurrent::Async
32
+ DEFAULT_SERVICE_NAME = "visual_recognition"
33
+ DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/visual-recognition/api"
32
34
  ##
33
35
  # @!method initialize(args)
34
36
  # Construct a new client for the Visual Recognition service.
@@ -47,19 +49,23 @@ module IBMWatson
47
49
  # @option args service_url [String] The base service URL to use when contacting the service.
48
50
  # The base service_url may differ between IBM Cloud regions.
49
51
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
52
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
53
+ # any external configuration, if applicable.
50
54
  def initialize(args = {})
51
55
  @__async_initialized__ = false
52
56
  defaults = {}
53
57
  defaults[:version] = nil
54
- defaults[:service_url] = "https://gateway.watsonplatform.net/visual-recognition/api"
58
+ defaults[:service_url] = DEFAULT_SERVICE_URL
59
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
55
60
  defaults[:authenticator] = nil
61
+ user_service_url = args[:service_url] unless args[:service_url].nil?
56
62
  args = defaults.merge(args)
57
63
  @version = args[:version]
58
64
  raise ArgumentError.new("version must be provided") if @version.nil?
59
65
 
60
- args[:service_name] = "visual_recognition"
61
66
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
62
67
  super
68
+ @service_url = user_service_url unless user_service_url.nil?
63
69
  end
64
70
 
65
71
  #########################
@@ -69,18 +69,7 @@ if !ENV["COMPARE_COMPLY_APIKEY"].nil?
69
69
  end
70
70
 
71
71
  def test_get_feedback
72
- @service_dup = IBMWatson::CompareComplyV1.new(
73
- iam_apikey: ENV["COMPARE_COMPLY_APIKEY"],
74
- version: "2018-10-15"
75
- )
76
- @service_dup.add_default_headers(
77
- headers: {
78
- "X-Watson-Learning-Opt-Out" => "1",
79
- "X-Watson-Test" => "1",
80
- "x-watson-metadata" => "customer_id=sdk-test-customer-id"
81
- }
82
- )
83
- response = @service_dup.get_feedback(
72
+ response = @service.get_feedback(
84
73
  feedback_id: ENV["COMPARE_COMPLY_FEEDBACK_ID"]
85
74
  ).result
86
75
  refute(response.nil?)
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: 1.3.1
4
+ version: 1.4.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: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby