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.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/ibm_watson/assistant_v1.rb +13 -5
- data/lib/ibm_watson/assistant_v2.rb +8 -2
- data/lib/ibm_watson/compare_comply_v1.rb +10 -4
- data/lib/ibm_watson/discovery_v1.rb +13 -7
- data/lib/ibm_watson/discovery_v2.rb +9 -3
- data/lib/ibm_watson/language_translator_v3.rb +25 -11
- data/lib/ibm_watson/natural_language_classifier_v1.rb +8 -2
- data/lib/ibm_watson/natural_language_understanding_v1.rb +14 -8
- data/lib/ibm_watson/personality_insights_v3.rb +8 -2
- data/lib/ibm_watson/speech_to_text_v1.rb +186 -65
- data/lib/ibm_watson/text_to_speech_v1.rb +26 -17
- data/lib/ibm_watson/tone_analyzer_v3.rb +8 -2
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +8 -2
- data/lib/ibm_watson/visual_recognition_v4.rb +8 -2
- data/test/integration/test_compare_comply_v1.rb +1 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d4c227c6c5c5022489eaf6a69b8b674ec91facde966f3e077b9c53c969ccd80
|
4
|
+
data.tar.gz: 1eed5dfb21f288d25d555828a741c5836b6b25c984d7f2b1eb3de2a9f703f977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a58cdc4bc68c22395584350e43e47d3d93a82602d41443dfb7160f9887241d76616372ec8a77f596686b47a7216a26b710107776d19c601f54dd05e2a20089
|
7
|
+
data.tar.gz: 5e80aa7bba94a5951ac4bbfae545c82a72f161f360b7e4b9633da07461d3ef679ceeb54880552216c84a33b7d8407599ac85035926f3b830fa9351664c70a4bf
|
data/README.md
CHANGED
@@ -129,7 +129,7 @@ IBM Cloud is migrating to token-based Identity and Access Management (IAM) authe
|
|
129
129
|
You supply either an IAM service **API key** or an **access token**:
|
130
130
|
|
131
131
|
* Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
|
132
|
-
* Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/
|
132
|
+
* Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/watson?topic=watson-iam).
|
133
133
|
|
134
134
|
#### Supplying the IAM API key
|
135
135
|
|
@@ -390,6 +390,10 @@ assistant = IBMWatson::AssistantV1.new(
|
|
390
390
|
|
391
391
|
```
|
392
392
|
|
393
|
+
## Questions
|
394
|
+
|
395
|
+
If you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+ruby).
|
396
|
+
|
393
397
|
## Ruby version
|
394
398
|
|
395
399
|
Tested on:
|
@@ -419,6 +423,6 @@ We'd love to highlight cool open-source projects that use this SDK! If you'd lik
|
|
419
423
|
[examples]: https://github.com/watson-developer-cloud/ruby-sdk/tree/master/examples
|
420
424
|
[CONTRIBUTING]: https://github.com/watson-developer-cloud/ruby-sdk/blob/master/CONTRIBUTING.md
|
421
425
|
[license]: http://www.apache.org/licenses/LICENSE-2.0
|
422
|
-
[vcap_services]: https://cloud.ibm.com/docs/
|
426
|
+
[vcap_services]: https://cloud.ibm.com/docs/watson?topic=watson-vcapServices
|
423
427
|
[ibm-cloud-onboarding]: http://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Ruby
|
424
428
|
[ivar]: http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/IVar.html
|
@@ -33,6 +33,8 @@ module IBMWatson
|
|
33
33
|
# The Assistant V1 service.
|
34
34
|
class AssistantV1 < IBMCloudSdkCore::BaseService
|
35
35
|
include Concurrent::Async
|
36
|
+
DEFAULT_SERVICE_NAME = "assistant"
|
37
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/assistant/api"
|
36
38
|
##
|
37
39
|
# @!method initialize(args)
|
38
40
|
# Construct a new client for the Assistant service.
|
@@ -51,19 +53,23 @@ module IBMWatson
|
|
51
53
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
52
54
|
# The base service_url may differ between IBM Cloud regions.
|
53
55
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
56
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
57
|
+
# any external configuration, if applicable.
|
54
58
|
def initialize(args = {})
|
55
59
|
@__async_initialized__ = false
|
56
60
|
defaults = {}
|
57
61
|
defaults[:version] = nil
|
58
|
-
defaults[:service_url] =
|
62
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
63
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
59
64
|
defaults[:authenticator] = nil
|
65
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
60
66
|
args = defaults.merge(args)
|
61
67
|
@version = args[:version]
|
62
68
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
63
69
|
|
64
|
-
args[:service_name] = "assistant"
|
65
70
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
66
71
|
super
|
72
|
+
@service_url = user_service_url unless user_service_url.nil?
|
67
73
|
end
|
68
74
|
|
69
75
|
#########################
|
@@ -706,7 +712,7 @@ module IBMWatson
|
|
706
712
|
# Create user input example.
|
707
713
|
# Add a new user input example to an intent.
|
708
714
|
#
|
709
|
-
# If you want to add multiple
|
715
|
+
# If you want to add multiple examples with a single API call, consider using the
|
710
716
|
# **[Update intent](#update-intent)** method instead.
|
711
717
|
#
|
712
718
|
# This operation is limited to 1000 requests per 30 minutes. For more information,
|
@@ -2054,7 +2060,8 @@ module IBMWatson
|
|
2054
2060
|
# @param digress_out_slots [String] Whether the user can digress to top-level nodes while filling out slots.
|
2055
2061
|
# @param user_label [String] A label that can be displayed externally to describe the purpose of the node to
|
2056
2062
|
# users.
|
2057
|
-
# @param disambiguation_opt_out [Boolean] Whether the dialog node should be excluded from disambiguation suggestions.
|
2063
|
+
# @param disambiguation_opt_out [Boolean] Whether the dialog node should be excluded from disambiguation suggestions. Valid
|
2064
|
+
# only when **type**=`standard` or `frame`.
|
2058
2065
|
# @param include_audit [Boolean] Whether to include the audit properties (`created` and `updated` timestamps) in
|
2059
2066
|
# the response.
|
2060
2067
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -2189,7 +2196,8 @@ module IBMWatson
|
|
2189
2196
|
# @param new_digress_out_slots [String] Whether the user can digress to top-level nodes while filling out slots.
|
2190
2197
|
# @param new_user_label [String] A label that can be displayed externally to describe the purpose of the node to
|
2191
2198
|
# users.
|
2192
|
-
# @param new_disambiguation_opt_out [Boolean] Whether the dialog node should be excluded from disambiguation suggestions.
|
2199
|
+
# @param new_disambiguation_opt_out [Boolean] Whether the dialog node should be excluded from disambiguation suggestions. Valid
|
2200
|
+
# only when **type**=`standard` or `frame`.
|
2193
2201
|
# @param include_audit [Boolean] Whether to include the audit properties (`created` and `updated` timestamps) in
|
2194
2202
|
# the response.
|
2195
2203
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -33,6 +33,8 @@ module IBMWatson
|
|
33
33
|
# The Assistant V2 service.
|
34
34
|
class AssistantV2 < IBMCloudSdkCore::BaseService
|
35
35
|
include Concurrent::Async
|
36
|
+
DEFAULT_SERVICE_NAME = "assistant"
|
37
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/assistant/api"
|
36
38
|
##
|
37
39
|
# @!method initialize(args)
|
38
40
|
# Construct a new client for the Assistant service.
|
@@ -51,19 +53,23 @@ module IBMWatson
|
|
51
53
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
52
54
|
# The base service_url may differ between IBM Cloud regions.
|
53
55
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
56
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
57
|
+
# any external configuration, if applicable.
|
54
58
|
def initialize(args = {})
|
55
59
|
@__async_initialized__ = false
|
56
60
|
defaults = {}
|
57
61
|
defaults[:version] = nil
|
58
|
-
defaults[:service_url] =
|
62
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
63
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
59
64
|
defaults[:authenticator] = nil
|
65
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
60
66
|
args = defaults.merge(args)
|
61
67
|
@version = args[:version]
|
62
68
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
63
69
|
|
64
|
-
args[:service_name] = "assistant"
|
65
70
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
66
71
|
super
|
72
|
+
@service_url = user_service_url unless user_service_url.nil?
|
67
73
|
end
|
68
74
|
|
69
75
|
#########################
|
@@ -29,6 +29,8 @@ module IBMWatson
|
|
29
29
|
# The Compare Comply V1 service.
|
30
30
|
class CompareComplyV1 < IBMCloudSdkCore::BaseService
|
31
31
|
include Concurrent::Async
|
32
|
+
DEFAULT_SERVICE_NAME = "compare_comply"
|
33
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/compare-comply/api"
|
32
34
|
##
|
33
35
|
# @!method initialize(args)
|
34
36
|
# Construct a new client for the Compare Comply 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] =
|
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] = "compare_comply"
|
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
|
#########################
|
@@ -473,10 +479,10 @@ module IBMWatson
|
|
473
479
|
# Run Compare and Comply methods over a collection of input documents.
|
474
480
|
#
|
475
481
|
# **Important:** Batch processing requires the use of the [IBM Cloud Object Storage
|
476
|
-
# service](https://cloud.ibm.com/docs/
|
482
|
+
# service](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage).
|
477
483
|
# The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using
|
478
484
|
# batch
|
479
|
-
# processing](https://cloud.ibm.com/docs/
|
485
|
+
# processing](https://cloud.ibm.com/docs/compare-comply?topic=compare-comply-batching#before-you-batch).
|
480
486
|
# @param function [String] The Compare and Comply method to run across the submitted input documents.
|
481
487
|
# @param input_credentials_file [File] A JSON file containing the input Cloud Object Storage credentials. At a minimum,
|
482
488
|
# the credentials must enable `READ` permissions on the bucket defined by the
|
@@ -32,6 +32,8 @@ module IBMWatson
|
|
32
32
|
# The Discovery V1 service.
|
33
33
|
class DiscoveryV1 < IBMCloudSdkCore::BaseService
|
34
34
|
include Concurrent::Async
|
35
|
+
DEFAULT_SERVICE_NAME = "discovery"
|
36
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/discovery/api"
|
35
37
|
##
|
36
38
|
# @!method initialize(args)
|
37
39
|
# Construct a new client for the Discovery service.
|
@@ -50,19 +52,23 @@ module IBMWatson
|
|
50
52
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
51
53
|
# The base service_url may differ between IBM Cloud regions.
|
52
54
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
55
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
56
|
+
# any external configuration, if applicable.
|
53
57
|
def initialize(args = {})
|
54
58
|
@__async_initialized__ = false
|
55
59
|
defaults = {}
|
56
60
|
defaults[:version] = nil
|
57
|
-
defaults[:service_url] =
|
61
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
62
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
58
63
|
defaults[:authenticator] = nil
|
64
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
59
65
|
args = defaults.merge(args)
|
60
66
|
@version = args[:version]
|
61
67
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
62
68
|
|
63
|
-
args[:service_name] = "discovery"
|
64
69
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
65
70
|
super
|
71
|
+
@service_url = user_service_url unless user_service_url.nil?
|
66
72
|
end
|
67
73
|
|
68
74
|
#########################
|
@@ -1312,7 +1318,7 @@ module IBMWatson
|
|
1312
1318
|
# Query a collection.
|
1313
1319
|
# By using this method, you can construct long queries. For details, see the
|
1314
1320
|
# [Discovery
|
1315
|
-
# documentation](https://cloud.ibm.com/docs/
|
1321
|
+
# documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts).
|
1316
1322
|
# @param environment_id [String] The ID of the environment.
|
1317
1323
|
# @param collection_id [String] The ID of the collection.
|
1318
1324
|
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
@@ -1432,7 +1438,7 @@ module IBMWatson
|
|
1432
1438
|
# Queries for notices (errors or warnings) that might have been generated by the
|
1433
1439
|
# system. Notices are generated when ingesting documents and performing relevance
|
1434
1440
|
# training. See the [Discovery
|
1435
|
-
# documentation](https://cloud.ibm.com/docs/
|
1441
|
+
# documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts)
|
1436
1442
|
# for more details on the query language.
|
1437
1443
|
# @param environment_id [String] The ID of the environment.
|
1438
1444
|
# @param collection_id [String] The ID of the collection.
|
@@ -1532,7 +1538,7 @@ module IBMWatson
|
|
1532
1538
|
# Query multiple collections.
|
1533
1539
|
# By using this method, you can construct long queries that search multiple
|
1534
1540
|
# collection. For details, see the [Discovery
|
1535
|
-
# documentation](https://cloud.ibm.com/docs/
|
1541
|
+
# documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts).
|
1536
1542
|
# @param environment_id [String] The ID of the environment.
|
1537
1543
|
# @param collection_ids [String] A comma-separated list of collection IDs to be queried against.
|
1538
1544
|
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
@@ -1646,7 +1652,7 @@ module IBMWatson
|
|
1646
1652
|
# Queries for notices (errors or warnings) that might have been generated by the
|
1647
1653
|
# system. Notices are generated when ingesting documents and performing relevance
|
1648
1654
|
# training. See the [Discovery
|
1649
|
-
# documentation](https://cloud.ibm.com/docs/
|
1655
|
+
# documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts)
|
1650
1656
|
# for more details on the query language.
|
1651
1657
|
# @param environment_id [String] The ID of the environment.
|
1652
1658
|
# @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
|
@@ -2184,7 +2190,7 @@ module IBMWatson
|
|
2184
2190
|
# You associate a customer ID with data by passing the **X-Watson-Metadata** header
|
2185
2191
|
# with a request that passes data. For more information about personal data and
|
2186
2192
|
# customer IDs, see [Information
|
2187
|
-
# security](https://cloud.ibm.com/docs/
|
2193
|
+
# security](https://cloud.ibm.com/docs/discovery?topic=discovery-information-security#information-security).
|
2188
2194
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
2189
2195
|
# @return [nil]
|
2190
2196
|
def delete_user_data(customer_id:)
|
@@ -32,6 +32,8 @@ module IBMWatson
|
|
32
32
|
# The Discovery V2 service.
|
33
33
|
class DiscoveryV2 < IBMCloudSdkCore::BaseService
|
34
34
|
include Concurrent::Async
|
35
|
+
DEFAULT_SERVICE_NAME = "discovery"
|
36
|
+
DEFAULT_SERVICE_URL = nil
|
35
37
|
##
|
36
38
|
# @!method initialize(args)
|
37
39
|
# Construct a new client for the Discovery service.
|
@@ -50,19 +52,23 @@ module IBMWatson
|
|
50
52
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
51
53
|
# The base service_url may differ between IBM Cloud regions.
|
52
54
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
55
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
56
|
+
# any external configuration, if applicable.
|
53
57
|
def initialize(args = {})
|
54
58
|
@__async_initialized__ = false
|
55
59
|
defaults = {}
|
56
60
|
defaults[:version] = nil
|
57
|
-
defaults[:service_url] =
|
61
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
62
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
58
63
|
defaults[:authenticator] = nil
|
64
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
59
65
|
args = defaults.merge(args)
|
60
66
|
@version = args[:version]
|
61
67
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
62
68
|
|
63
|
-
args[:service_name] = "discovery"
|
64
69
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
65
70
|
super
|
71
|
+
@service_url = user_service_url unless user_service_url.nil?
|
66
72
|
end
|
67
73
|
|
68
74
|
#########################
|
@@ -107,7 +113,7 @@ module IBMWatson
|
|
107
113
|
# @!method query(project_id:, collection_ids: nil, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, spelling_suggestions: nil, table_results: nil, suggested_refinements: nil, passages: nil)
|
108
114
|
# Query a project.
|
109
115
|
# By using this method, you can construct queries. For details, see the [Discovery
|
110
|
-
# documentation](https://cloud.ibm.com/docs/
|
116
|
+
# documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts).
|
111
117
|
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
112
118
|
# Discovery administrative tooling.
|
113
119
|
# @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
|
@@ -32,6 +32,8 @@ module IBMWatson
|
|
32
32
|
# The Language Translator V3 service.
|
33
33
|
class LanguageTranslatorV3 < IBMCloudSdkCore::BaseService
|
34
34
|
include Concurrent::Async
|
35
|
+
DEFAULT_SERVICE_NAME = "language_translator"
|
36
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/language-translator/api"
|
35
37
|
##
|
36
38
|
# @!method initialize(args)
|
37
39
|
# Construct a new client for the Language Translator service.
|
@@ -50,19 +52,23 @@ module IBMWatson
|
|
50
52
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
51
53
|
# The base service_url may differ between IBM Cloud regions.
|
52
54
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
55
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
56
|
+
# any external configuration, if applicable.
|
53
57
|
def initialize(args = {})
|
54
58
|
@__async_initialized__ = false
|
55
59
|
defaults = {}
|
56
60
|
defaults[:version] = nil
|
57
|
-
defaults[:service_url] =
|
61
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
62
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
58
63
|
defaults[:authenticator] = nil
|
64
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
59
65
|
args = defaults.merge(args)
|
60
66
|
@version = args[:version]
|
61
67
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
62
68
|
|
63
|
-
args[:service_name] = "language_translator"
|
64
69
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
65
70
|
super
|
71
|
+
@service_url = user_service_url unless user_service_url.nil?
|
66
72
|
end
|
67
73
|
|
68
74
|
#########################
|
@@ -72,13 +78,18 @@ module IBMWatson
|
|
72
78
|
##
|
73
79
|
# @!method translate(text:, model_id: nil, source: nil, target: nil)
|
74
80
|
# Translate.
|
75
|
-
# Translates the input text from the source language to the target language.
|
81
|
+
# Translates the input text from the source language to the target language. A
|
82
|
+
# target language or translation model ID is required. The service attempts to
|
83
|
+
# detect the language of the source text if it is not specified.
|
76
84
|
# @param text [Array[String]] Input text in UTF-8 encoding. Multiple entries will result in multiple
|
77
85
|
# translations in the response.
|
78
|
-
# @param model_id [String]
|
79
|
-
# translation.
|
80
|
-
#
|
81
|
-
#
|
86
|
+
# @param model_id [String] The model to use for translation. For example, `en-de` selects the IBM provided
|
87
|
+
# base model for English to German translation. A model ID overrides the source and
|
88
|
+
# target parameters and is required if you use a custom model. If no model ID is
|
89
|
+
# specified, you must specify a target language.
|
90
|
+
# @param source [String] Language code that specifies the language of the source document.
|
91
|
+
# @param target [String] Language code that specifies the target language for translation. Required if
|
92
|
+
# model ID is not specified.
|
82
93
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
83
94
|
def translate(text:, model_id: nil, source: nil, target: nil)
|
84
95
|
raise ArgumentError.new("text must be provided") if text.nil?
|
@@ -394,15 +405,18 @@ module IBMWatson
|
|
394
405
|
# @param file [File] The contents of the source file to translate.
|
395
406
|
#
|
396
407
|
# [Supported file
|
397
|
-
# types](https://cloud.ibm.com/docs/
|
408
|
+
# types](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats)
|
398
409
|
#
|
399
410
|
# Maximum file size: **20 MB**.
|
400
411
|
# @param filename [String] The filename for file.
|
401
412
|
# @param file_content_type [String] The content type of file.
|
402
|
-
# @param model_id [String] The model to use for translation.
|
403
|
-
#
|
413
|
+
# @param model_id [String] The model to use for translation. For example, `en-de` selects the IBM provided
|
414
|
+
# base model for English to German translation. A model ID overrides the source and
|
415
|
+
# target parameters and is required if you use a custom model. If no model ID is
|
416
|
+
# specified, you must specify a target language.
|
404
417
|
# @param source [String] Language code that specifies the language of the source document.
|
405
|
-
# @param target [String] Language code that specifies the target language for translation.
|
418
|
+
# @param target [String] Language code that specifies the target language for translation. Required if
|
419
|
+
# model ID is not specified.
|
406
420
|
# @param document_id [String] To use a previously submitted document as the source for a new translation, enter
|
407
421
|
# the `document_id` of the document.
|
408
422
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -31,6 +31,8 @@ module IBMWatson
|
|
31
31
|
# The Natural Language Classifier V1 service.
|
32
32
|
class NaturalLanguageClassifierV1 < IBMCloudSdkCore::BaseService
|
33
33
|
include Concurrent::Async
|
34
|
+
DEFAULT_SERVICE_NAME = "natural_language_classifier"
|
35
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/natural-language-classifier/api"
|
34
36
|
##
|
35
37
|
# @!method initialize(args)
|
36
38
|
# Construct a new client for the Natural Language Classifier service.
|
@@ -39,15 +41,19 @@ module IBMWatson
|
|
39
41
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
40
42
|
# The base service_url may differ between IBM Cloud regions.
|
41
43
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
44
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
45
|
+
# any external configuration, if applicable.
|
42
46
|
def initialize(args = {})
|
43
47
|
@__async_initialized__ = false
|
44
48
|
defaults = {}
|
45
|
-
defaults[:service_url] =
|
49
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
50
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
46
51
|
defaults[:authenticator] = nil
|
52
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
47
53
|
args = defaults.merge(args)
|
48
|
-
args[:service_name] = "natural_language_classifier"
|
49
54
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
50
55
|
super
|
56
|
+
@service_url = user_service_url unless user_service_url.nil?
|
51
57
|
end
|
52
58
|
|
53
59
|
#########################
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# can ignore most advertisements and other unwanted content.
|
21
21
|
#
|
22
22
|
# You can create [custom
|
23
|
-
# models](https://cloud.ibm.com/docs/
|
23
|
+
# models](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing)
|
24
24
|
# with Watson Knowledge Studio to detect custom entities and relations in Natural Language
|
25
25
|
# Understanding.
|
26
26
|
|
@@ -36,6 +36,8 @@ module IBMWatson
|
|
36
36
|
# The Natural Language Understanding V1 service.
|
37
37
|
class NaturalLanguageUnderstandingV1 < IBMCloudSdkCore::BaseService
|
38
38
|
include Concurrent::Async
|
39
|
+
DEFAULT_SERVICE_NAME = "natural_language_understanding"
|
40
|
+
DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/natural-language-understanding/api"
|
39
41
|
##
|
40
42
|
# @!method initialize(args)
|
41
43
|
# Construct a new client for the Natural Language Understanding service.
|
@@ -54,19 +56,23 @@ module IBMWatson
|
|
54
56
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
55
57
|
# The base service_url may differ between IBM Cloud regions.
|
56
58
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
59
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
60
|
+
# any external configuration, if applicable.
|
57
61
|
def initialize(args = {})
|
58
62
|
@__async_initialized__ = false
|
59
63
|
defaults = {}
|
60
64
|
defaults[:version] = nil
|
61
|
-
defaults[:service_url] =
|
65
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
66
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
62
67
|
defaults[:authenticator] = nil
|
68
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
63
69
|
args = defaults.merge(args)
|
64
70
|
@version = args[:version]
|
65
71
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
66
72
|
|
67
|
-
args[:service_name] = "natural_language_understanding"
|
68
73
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
69
74
|
super
|
75
|
+
@service_url = user_service_url unless user_service_url.nil?
|
70
76
|
end
|
71
77
|
|
72
78
|
#########################
|
@@ -90,7 +96,7 @@ module IBMWatson
|
|
90
96
|
#
|
91
97
|
# If a language for the input text is not specified with the `language` parameter,
|
92
98
|
# the service [automatically detects the
|
93
|
-
# language](https://cloud.ibm.com/docs/
|
99
|
+
# language](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-detectable-languages).
|
94
100
|
# @param features [Features] Specific features to analyze the document for.
|
95
101
|
# @param text [String] The plain text to analyze. One of the `text`, `html`, or `url` parameters is
|
96
102
|
# required.
|
@@ -100,10 +106,10 @@ module IBMWatson
|
|
100
106
|
# required.
|
101
107
|
# @param clean [Boolean] Set this to `false` to disable webpage cleaning. To learn more about webpage
|
102
108
|
# cleaning, see the [Analyzing
|
103
|
-
# webpages](https://cloud.ibm.com/docs/
|
109
|
+
# webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages)
|
104
110
|
# documentation.
|
105
111
|
# @param xpath [String] An [XPath
|
106
|
-
# query](https://cloud.ibm.com/docs/
|
112
|
+
# query](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages#xpath)
|
107
113
|
# to perform on `html` or `url` input. Results of the query will be appended to the
|
108
114
|
# cleaned webpage text before it is analyzed. To analyze only the results of the
|
109
115
|
# XPath query, set the `clean` parameter to `false`.
|
@@ -112,7 +118,7 @@ module IBMWatson
|
|
112
118
|
# @param language [String] ISO 639-1 code that specifies the language of your text. This overrides automatic
|
113
119
|
# language detection. Language support differs depending on the features you include
|
114
120
|
# in your analysis. See [Language
|
115
|
-
# support](https://cloud.ibm.com/docs/
|
121
|
+
# support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support)
|
116
122
|
# for more information.
|
117
123
|
# @param limit_text_characters [Fixnum] Sets the maximum number of characters that are processed by the service.
|
118
124
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -161,7 +167,7 @@ module IBMWatson
|
|
161
167
|
# @!method list_models
|
162
168
|
# List models.
|
163
169
|
# Lists Watson Knowledge Studio [custom entities and relations
|
164
|
-
# models](https://cloud.ibm.com/docs/
|
170
|
+
# models](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing)
|
165
171
|
# that are deployed to your Natural Language Understanding service.
|
166
172
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
167
173
|
def list_models
|