ibm_watson 0.7.0 → 0.8.0

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.
@@ -15,58 +15,23 @@
15
15
  # limitations under the License.
16
16
 
17
17
  # ### Service Overview
18
- # The IBM® Text to Speech service provides an API that uses IBM's speech-synthesis
18
+ # The IBM® Text to Speech service provides APIs that use IBM's speech-synthesis
19
19
  # capabilities to synthesize text into natural-sounding speech in a variety of languages,
20
20
  # dialects, and voices. The service supports at least one male or female voice, sometimes
21
21
  # both, for each language. The audio is streamed back to the client with minimal delay.
22
- # For more information about the service, see the [IBM® Cloud
23
- # documentation](https://console.bluemix.net/docs/services/text-to-speech/index.html).
24
22
  #
25
- # ### API usage guidelines
26
- # * **Audio formats:** The service can produce audio in many formats (MIME types). See
27
- # [Specifying an audio
28
- # format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format).
29
- # * **SSML:** Many methods refer to the Speech Synthesis Markup Language (SSML). SSML is
30
- # an XML-based markup language that provides text annotation for speech-synthesis
31
- # applications. See [Using
32
- # SSML](https://console.bluemix.net/docs/services/text-to-speech/SSML.html) and [Using IBM
33
- # SPR](https://console.bluemix.net/docs/services/text-to-speech/SPRs.html).
34
- # * **Word translations:** Many customization methods accept sounds-like or phonetic
35
- # translations for words. Phonetic translations are based on the SSML phoneme format for
36
- # representing a word. You can specify them in standard International Phonetic Alphabet
37
- # (IPA) representation
23
+ # For speech synthesis, the service supports a synchronous HTTP Representational State
24
+ # Transfer (REST) interface. It also supports a WebSocket interface that provides both
25
+ # plain text and SSML input, including the SSML <mark> element and word timings.
26
+ # SSML is an XML-based markup language that provides text annotation for speech-synthesis
27
+ # applications.
38
28
  #
39
- # <phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>
40
- #
41
- # or in the proprietary IBM Symbolic Phonetic Representation (SPR)
42
- #
43
- # <phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>
44
- #
45
- # See [Understanding
46
- # customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html).
47
- # * **WebSocket interface:** The service also offers a WebSocket interface for speech
48
- # synthesis. The WebSocket interface supports both plain text and SSML input, including
49
- # the SSML <mark> element and word timings. See [The WebSocket
50
- # interface](https://console.bluemix.net/docs/services/text-to-speech/websockets.html).
51
- # * **Customization IDs:** Many methods accept a customization ID, which is a Globally
52
- # Unique Identifier (GUID). Customization IDs are hexadecimal strings that have the format
53
- # `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.
54
- # * **`X-Watson-Learning-Opt-Out`:** By default, all Watson services log requests and
55
- # their results. Logging is done only to improve the services for future users. The logged
56
- # data is not shared or made public. To prevent IBM from accessing your data for general
57
- # service improvements, set the `X-Watson-Learning-Opt-Out` request header to `true` for
58
- # all requests. You must set the header on each request that you do not want IBM to access
59
- # for general service improvements.
60
- #
61
- # Methods of the customization interface do not log words and translations that you use
62
- # to build custom voice models. Your training data is never used to improve the service's
63
- # base models. However, the service does log such data when a custom model is used with a
64
- # synthesize request. You must set the `X-Watson-Learning-Opt-Out` request header to
65
- # `true` to prevent IBM from accessing the data to improve the service.
66
- # * **`X-Watson-Metadata`:** This header allows you to associate a customer ID with data
67
- # that is passed with a request. If necessary, you can use the **Delete labeled data**
68
- # method to delete the data for a customer ID. See [Information
69
- # security](https://console.bluemix.net/docs/services/text-to-speech/information-security.html).
29
+ # The service also offers a customization interface. You can use the interface to define
30
+ # sounds-like or phonetic translations for words. A sounds-like translation consists of
31
+ # one or more words that, when combined, sound like the word. A phonetic translation is
32
+ # based on the SSML phoneme format for representing a word. You can specify a phonetic
33
+ # translation in standard International Phonetic Alphabet (IPA) representation or in the
34
+ # proprietary IBM Symbolic Phonetic Representation (SPR).
70
35
 
71
36
  require "concurrent"
72
37
  require "erb"
@@ -132,6 +97,9 @@ module IBMWatson
132
97
  # Lists all voices available for use with the service. The information includes the
133
98
  # name, language, gender, and other details about the voice. To see information
134
99
  # about a specific voice, use the **Get a voice** method.
100
+ #
101
+ # **See also:** [Specifying a
102
+ # voice](https://console.bluemix.net/docs/services/text-to-speech/http.html#voices).
135
103
  # @return [DetailedResponse] A `DetailedResponse` object representing the response.
136
104
  def list_voices
137
105
  headers = {
@@ -153,6 +121,9 @@ module IBMWatson
153
121
  # language, gender, and other details about the voice. Specify a customization ID to
154
122
  # obtain information for that custom voice model of the specified voice. To list
155
123
  # information about all available voices, use the **List voices** method.
124
+ #
125
+ # **See also:** [Specifying a
126
+ # voice](https://console.bluemix.net/docs/services/text-to-speech/http.html#voices).
156
127
  # @param voice [String] The voice for which information is to be returned.
157
128
  # @param customization_id [String] The customization ID (GUID) of a custom voice model for which information is to be
158
129
  # returned. You must make the request with service credentials created for the
@@ -187,11 +158,7 @@ module IBMWatson
187
158
  # Synthesizes text to spoken audio, returning the synthesized audio stream as an
188
159
  # array of bytes. You can pass a maximum of 5 KB of text. Use the `Accept` header
189
160
  # or the `accept` query parameter to specify the requested format (MIME type) of the
190
- # response audio. By default, the service uses `audio/ogg;codecs=opus`. For detailed
191
- # information about the supported audio formats and sampling rates, see [Specifying
192
- # an audio
193
- # format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format).
194
- #
161
+ # response audio. By default, the service uses `audio/ogg;codecs=opus`.
195
162
  #
196
163
  # If a request includes invalid query parameters, the service returns a `Warnings`
197
164
  # response header that provides messages about the invalid parameters. The warning
@@ -199,6 +166,9 @@ module IBMWatson
199
166
  # example, a message such as `\"Unknown arguments:\"` or `\"Unknown url query
200
167
  # arguments:\"` followed by a list of the form `\"invalid_arg_1, invalid_arg_2.\"`
201
168
  # The request succeeds despite the warnings.
169
+ #
170
+ # **See also:** [Synthesizing text to
171
+ # audio](https://console.bluemix.net/docs/services/text-to-speech/http.html#synthesize).
202
172
  # @param text [String] The text to synthesize.
203
173
  # @param accept [String] The requested audio format (MIME type) of the audio. You can use the `Accept`
204
174
  # header or the `accept` query parameter to specify the audio format. (For the
@@ -251,6 +221,9 @@ module IBMWatson
251
221
  # for a specific custom voice model to see the translation for that voice model.
252
222
  #
253
223
  # **Note:** This method is currently a beta release.
224
+ #
225
+ # **See also:** [Querying a word from a
226
+ # language](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuWordsQueryLanguage).
254
227
  # @param text [String] The word for which the pronunciation is requested.
255
228
  # @param voice [String] A voice that specifies the language in which the pronunciation is to be returned.
256
229
  # All voices for the same language (for example, `en-US`) return the same
@@ -299,6 +272,9 @@ module IBMWatson
299
272
  # used to create it.
300
273
  #
301
274
  # **Note:** This method is currently a beta release.
275
+ #
276
+ # **See also:** [Creating a custom
277
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#cuModelsCreate).
302
278
  # @param name [String] The name of the new custom voice model.
303
279
  # @param language [String] The language of the new custom voice model. Omit the parameter to use the the
304
280
  # default language, `en-US`.
@@ -337,6 +313,9 @@ module IBMWatson
337
313
  # about it.
338
314
  #
339
315
  # **Note:** This method is currently a beta release.
316
+ #
317
+ # **See also:** [Querying all custom
318
+ # models](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#cuModelsQueryAll).
340
319
  # @param language [String] The language for which custom voice models that are owned by the requesting
341
320
  # service credentials are to be returned. Omit the parameter to see all custom voice
342
321
  # models that are owned by the requester.
@@ -368,7 +347,29 @@ module IBMWatson
368
347
  # custom model can contain no more than 20,000 entries. You must use credentials for
369
348
  # the instance of the service that owns a model to update it.
370
349
  #
350
+ # You can define sounds-like or phonetic translations for words. A sounds-like
351
+ # translation consists of one or more words that, when combined, sound like the
352
+ # word. Phonetic translations are based on the SSML phoneme format for representing
353
+ # a word. You can specify them in standard International Phonetic Alphabet (IPA)
354
+ # representation
355
+ #
356
+ # <code>&lt;phoneme alphabet=\"ipa\"
357
+ # ph=\"t&#601;m&#712;&#593;to\"&gt;&lt;/phoneme&gt;</code>
358
+ #
359
+ # or in the proprietary IBM Symbolic Phonetic Representation (SPR)
360
+ #
361
+ # <code>&lt;phoneme alphabet=\"ibm\"
362
+ # ph=\"1gAstroEntxrYFXs\"&gt;&lt;/phoneme&gt;</code>
363
+ #
371
364
  # **Note:** This method is currently a beta release.
365
+ #
366
+ # **See also:**
367
+ # * [Updating a custom
368
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#cuModelsUpdate)
369
+ # * [Adding words to a Japanese custom
370
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
371
+ # * [Understanding
372
+ # customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html).
372
373
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
373
374
  # with service credentials created for the instance of the service that owns the
374
375
  # custom model.
@@ -408,6 +409,9 @@ module IBMWatson
408
409
  # voice model, use the **List custom models** method.
409
410
  #
410
411
  # **Note:** This method is currently a beta release.
412
+ #
413
+ # **See also:** [Querying a custom
414
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#cuModelsQuery).
411
415
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
412
416
  # with service credentials created for the instance of the service that owns the
413
417
  # custom model.
@@ -434,6 +438,9 @@ module IBMWatson
434
438
  # instance of the service that owns a model to delete it.
435
439
  #
436
440
  # **Note:** This method is currently a beta release.
441
+ #
442
+ # **See also:** [Deleting a custom
443
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#cuModelsDelete).
437
444
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
438
445
  # with service credentials created for the instance of the service that owns the
439
446
  # custom model.
@@ -465,7 +472,29 @@ module IBMWatson
465
472
  # than 20,000 entries. You must use credentials for the instance of the service that
466
473
  # owns a model to add words to it.
467
474
  #
475
+ # You can define sounds-like or phonetic translations for words. A sounds-like
476
+ # translation consists of one or more words that, when combined, sound like the
477
+ # word. Phonetic translations are based on the SSML phoneme format for representing
478
+ # a word. You can specify them in standard International Phonetic Alphabet (IPA)
479
+ # representation
480
+ #
481
+ # <code>&lt;phoneme alphabet=\"ipa\"
482
+ # ph=\"t&#601;m&#712;&#593;to\"&gt;&lt;/phoneme&gt;</code>
483
+ #
484
+ # or in the proprietary IBM Symbolic Phonetic Representation (SPR)
485
+ #
486
+ # <code>&lt;phoneme alphabet=\"ibm\"
487
+ # ph=\"1gAstroEntxrYFXs\"&gt;&lt;/phoneme&gt;</code>
488
+ #
468
489
  # **Note:** This method is currently a beta release.
490
+ #
491
+ # **See also:**
492
+ # * [Adding multiple words to a custom
493
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuWordsAdd)
494
+ # * [Adding words to a Japanese custom
495
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
496
+ # * [Understanding
497
+ # customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html).
469
498
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
470
499
  # with service credentials created for the instance of the service that owns the
471
500
  # custom model.
@@ -508,6 +537,9 @@ module IBMWatson
508
537
  # words.
509
538
  #
510
539
  # **Note:** This method is currently a beta release.
540
+ #
541
+ # **See also:** [Querying all words from a custom
542
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuWordsQueryModel).
511
543
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
512
544
  # with service credentials created for the instance of the service that owns the
513
545
  # custom model.
@@ -536,7 +568,29 @@ module IBMWatson
536
568
  # entries. You must use credentials for the instance of the service that owns a
537
569
  # model to add a word to it.
538
570
  #
571
+ # You can define sounds-like or phonetic translations for words. A sounds-like
572
+ # translation consists of one or more words that, when combined, sound like the
573
+ # word. Phonetic translations are based on the SSML phoneme format for representing
574
+ # a word. You can specify them in standard International Phonetic Alphabet (IPA)
575
+ # representation
576
+ #
577
+ # <code>&lt;phoneme alphabet=\"ipa\"
578
+ # ph=\"t&#601;m&#712;&#593;to\"&gt;&lt;/phoneme&gt;</code>
579
+ #
580
+ # or in the proprietary IBM Symbolic Phonetic Representation (SPR)
581
+ #
582
+ # <code>&lt;phoneme alphabet=\"ibm\"
583
+ # ph=\"1gAstroEntxrYFXs\"&gt;&lt;/phoneme&gt;</code>
584
+ #
539
585
  # **Note:** This method is currently a beta release.
586
+ #
587
+ # **See also:**
588
+ # * [Adding a single word to a custom
589
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuWordAdd)
590
+ # * [Adding words to a Japanese custom
591
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuJapaneseAdd)
592
+ # * [Understanding
593
+ # customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html).
540
594
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
541
595
  # with service credentials created for the instance of the service that owns the
542
596
  # custom model.
@@ -584,6 +638,9 @@ module IBMWatson
584
638
  # the instance of the service that owns a model to list its words.
585
639
  #
586
640
  # **Note:** This method is currently a beta release.
641
+ #
642
+ # **See also:** [Querying a single word from a custom
643
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuWordQueryModel).
587
644
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
588
645
  # with service credentials created for the instance of the service that owns the
589
646
  # custom model.
@@ -614,6 +671,9 @@ module IBMWatson
614
671
  #
615
672
  #
616
673
  # **Note:** This method is currently a beta release.
674
+ #
675
+ # **See also:** [Deleting a word from a custom
676
+ # model](https://console.bluemix.net/docs/services/text-to-speech/custom-entries.html#cuWordDelete).
617
677
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
618
678
  # with service credentials created for the instance of the service that owns the
619
679
  # custom model.
@@ -649,8 +709,9 @@ module IBMWatson
649
709
  # the service that was used to associate the customer ID with the data.
650
710
  #
651
711
  # You associate a customer ID with data by passing the `X-Watson-Metadata` header
652
- # with a request that passes the data. For more information about customer IDs and
653
- # about using this method, see [Information
712
+ # with a request that passes the data.
713
+ #
714
+ # **See also:** [Information
654
715
  # security](https://console.bluemix.net/docs/services/text-to-speech/information-security.html).
655
716
  # @param customer_id [String] The customer ID for which all data is to be deleted.
656
717
  # @return [nil]
@@ -116,6 +116,9 @@ module IBMWatson
116
116
  # to indicate the character encoding of the input text; for example: `Content-Type:
117
117
  # text/plain;charset=utf-8`. For `text/html`, the service removes HTML tags and
118
118
  # analyzes only the textual content.
119
+ #
120
+ # **See also:** [Using the general-purpose
121
+ # endpoint](https://console.bluemix.net/docs/services/tone-analyzer/using-tone.html#using-the-general-purpose-endpoint).
119
122
  # @param tone_input [ToneInput] JSON, plain text, or HTML input that contains the content to be analyzed. For JSON
120
123
  # input, provide an object of type `ToneInput`.
121
124
  # @param content_type [String] The type of the input. A character encoding can be specified by including a
@@ -186,10 +189,11 @@ module IBMWatson
186
189
  # overall content and analyzes only the first 50 utterances. If you submit a single
187
190
  # utterance that contains more than 500 characters, the service returns an error for
188
191
  # that utterance and does not analyze the utterance. The request fails if all
189
- # utterances have more than 500 characters.
192
+ # utterances have more than 500 characters. Per the JSON specification, the default
193
+ # character encoding for JSON content is effectively always UTF-8.
190
194
  #
191
- # Per the JSON specification, the default character encoding for JSON content is
192
- # effectively always UTF-8.
195
+ # **See also:** [Using the customer-engagement
196
+ # endpoint](https://console.bluemix.net/docs/services/tone-analyzer/using-tone-chat.html#using-the-customer-engagement-endpoint).
193
197
  # @param utterances [Array[Utterance]] An array of `Utterance` objects that provides the input content that the service
194
198
  # is to analyze.
195
199
  # @param content_language [String] The language of the input text for the request: English or French. Regional
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IBMWatson
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
@@ -49,7 +49,6 @@ module IBMWatson
49
49
  # @option args url [String] The base url to use when contacting the service (e.g.
50
50
  # "https://gateway.watsonplatform.net/visual-recognition/api").
51
51
  # The base url may differ between Bluemix regions.
52
- # @option args api_key [String] The API Key used to authenticate.
53
52
  # @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
54
53
  # this API key is provided, the SDK will manage the token and handle the
55
54
  # refreshing.
@@ -64,7 +63,6 @@ module IBMWatson
64
63
  defaults = {}
65
64
  defaults[:version] = nil
66
65
  defaults[:url] = "https://gateway.watsonplatform.net/visual-recognition/api"
67
- defaults[:api_key] = nil
68
66
  defaults[:iam_apikey] = nil
69
67
  defaults[:iam_access_token] = nil
70
68
  defaults[:iam_url] = nil
@@ -28,7 +28,6 @@ class WatsonService
28
28
  username: nil,
29
29
  password: nil,
30
30
  use_vcap_services: true,
31
- api_key: nil,
32
31
  iam_apikey: nil,
33
32
  iam_access_token: nil,
34
33
  iam_url: nil
@@ -196,8 +196,9 @@ if !ENV["DISCOVERY_USERNAME"].nil? && !ENV["DISCOVERY_PASSWORD"].nil?
196
196
  environment_id: @environment_id,
197
197
  collection_id: @collection_id,
198
198
  filter: "extracted_metadata.sha1::9181d244*",
199
- return_fields: ["extracted_metadata.sha1"]
199
+ return_fields: "extracted_metadata.sha1"
200
200
  ).result
201
+ puts query_results
201
202
  refute(query_results.nil?)
202
203
  end
203
204
 
@@ -254,8 +254,9 @@ class DiscoveryV1Test < Minitest::Test
254
254
  password: "password",
255
255
  version: "2018-03-05"
256
256
  )
257
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/query?count=10&version=2018-03-05")
257
+ stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/query?version=2018-03-05")
258
258
  .with(
259
+ body: "{\"count\":10}",
259
260
  headers: {
260
261
  "Accept" => "application/json",
261
262
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
@@ -952,12 +953,14 @@ class DiscoveryV1Test < Minitest::Test
952
953
  password: "password",
953
954
  version: "2018-03-05"
954
955
  )
955
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/query?collection_ids=collid&version=2018-03-05")
956
+ stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/query?&version=2018-03-05")
956
957
  .with(
958
+ body: "{\"collection_ids\":[\"collid\"]}",
957
959
  headers: {
958
960
  "Accept" => "application/json",
959
961
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
960
- "Host" => "gateway.watsonplatform.net"
962
+ "Host" => "gateway.watsonplatform.net",
963
+ "Content-type" => "application/json"
961
964
  }
962
965
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
963
966
  service_response = service.federated_query(
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.7.0
4
+ version: 0.8.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-09-24 00:00:00.000000000 Z
11
+ date: 2018-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby