ibm_watson 0.16.1 → 0.17.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.
@@ -49,16 +49,16 @@ module IBMWatson
49
49
  # ready for a later version.
50
50
  # @option args url [String] The base url to use when contacting the service (e.g.
51
51
  # "https://gateway.watsonplatform.net/language-translator/api").
52
- # The base url may differ between Bluemix regions.
52
+ # The base url may differ between IBM Cloud regions.
53
53
  # @option args username [String] The username used to authenticate with the service.
54
54
  # Username and password credentials are only required to run your
55
- # application locally or outside of Bluemix. When running on
56
- # Bluemix, the credentials will be automatically loaded from the
55
+ # application locally or outside of IBM Cloud. When running on
56
+ # IBM Cloud, the credentials will be automatically loaded from the
57
57
  # `VCAP_SERVICES` environment variable.
58
58
  # @option args password [String] The password used to authenticate with the service.
59
59
  # Username and password credentials are only required to run your
60
- # application locally or outside of Bluemix. When running on
61
- # Bluemix, the credentials will be automatically loaded from the
60
+ # application locally or outside of IBM Cloud. When running on
61
+ # IBM Cloud, the credentials will be automatically loaded from the
62
62
  # `VCAP_SERVICES` environment variable.
63
63
  # @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
64
64
  # this API key is provided, the SDK will manage the token and handle the
@@ -68,7 +68,9 @@ module IBMWatson
68
68
  # it expires or reactively upon receiving a 401 from the service as any requests
69
69
  # made with an expired token will fail.
70
70
  # @option args iam_url [String] An optional URL for the IAM service API. Defaults to
71
- # 'https://iam.ng.bluemix.net/identity/token'.
71
+ # 'https://iam.cloud.ibm.com/identity/token'.
72
+ # @option args iam_client_id [String] An optional client id for the IAM service API.
73
+ # @option args iam_client_secret [String] An optional client secret for the IAM service API.
72
74
  def initialize(args = {})
73
75
  @__async_initialized__ = false
74
76
  defaults = {}
@@ -79,6 +81,8 @@ module IBMWatson
79
81
  defaults[:iam_apikey] = nil
80
82
  defaults[:iam_access_token] = nil
81
83
  defaults[:iam_url] = nil
84
+ defaults[:iam_client_id] = nil
85
+ defaults[:iam_client_secret] = nil
82
86
  args = defaults.merge(args)
83
87
  args[:vcap_services_name] = "language_translator"
84
88
  super
@@ -136,6 +140,34 @@ module IBMWatson
136
140
  # Identification
137
141
  #########################
138
142
 
143
+ ##
144
+ # @!method list_identifiable_languages
145
+ # List identifiable languages.
146
+ # Lists the languages that the service can identify. Returns the language code (for
147
+ # example, `en` for English or `es` for Spanish) and name of each language.
148
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
149
+ def list_identifiable_languages
150
+ headers = {
151
+ }
152
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_identifiable_languages")
153
+ headers.merge!(sdk_headers)
154
+
155
+ params = {
156
+ "version" => @version
157
+ }
158
+
159
+ method_url = "/v3/identifiable_languages"
160
+
161
+ response = request(
162
+ method: "GET",
163
+ url: method_url,
164
+ headers: headers,
165
+ params: params,
166
+ accept_json: true
167
+ )
168
+ response
169
+ end
170
+
139
171
  ##
140
172
  # @!method identify(text:)
141
173
  # Identify language.
@@ -169,24 +201,35 @@ module IBMWatson
169
201
  )
170
202
  response
171
203
  end
204
+ #########################
205
+ # Models
206
+ #########################
172
207
 
173
208
  ##
174
- # @!method list_identifiable_languages
175
- # List identifiable languages.
176
- # Lists the languages that the service can identify. Returns the language code (for
177
- # example, `en` for English or `es` for Spanish) and name of each language.
209
+ # @!method list_models(source: nil, target: nil, default_models: nil)
210
+ # List models.
211
+ # Lists available translation models.
212
+ # @param source [String] Specify a language code to filter results by source language.
213
+ # @param target [String] Specify a language code to filter results by target language.
214
+ # @param default_models [Boolean] If the default parameter isn't specified, the service will return all models
215
+ # (default and non-default) for each language pair. To return only default models,
216
+ # set this to `true`. To return only non-default models, set this to `false`. There
217
+ # is exactly one default model per language pair, the IBM provided base model.
178
218
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
179
- def list_identifiable_languages
219
+ def list_models(source: nil, target: nil, default_models: nil)
180
220
  headers = {
181
221
  }
182
- sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_identifiable_languages")
222
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_models")
183
223
  headers.merge!(sdk_headers)
184
224
 
185
225
  params = {
186
- "version" => @version
226
+ "version" => @version,
227
+ "source" => source,
228
+ "target" => target,
229
+ "default" => default_models
187
230
  }
188
231
 
189
- method_url = "/v3/identifiable_languages"
232
+ method_url = "/v3/models"
190
233
 
191
234
  response = request(
192
235
  method: "GET",
@@ -197,9 +240,6 @@ module IBMWatson
197
240
  )
198
241
  response
199
242
  end
200
- #########################
201
- # Models
202
- #########################
203
243
 
204
244
  ##
205
245
  # @!method create_model(base_model_id:, forced_glossary: nil, parallel_corpus: nil, name: nil)
@@ -339,32 +379,193 @@ module IBMWatson
339
379
  )
340
380
  response
341
381
  end
382
+ #########################
383
+ # Document translation
384
+ #########################
342
385
 
343
386
  ##
344
- # @!method list_models(source: nil, target: nil, default_models: nil)
345
- # List models.
346
- # Lists available translation models.
347
- # @param source [String] Specify a language code to filter results by source language.
348
- # @param target [String] Specify a language code to filter results by target language.
349
- # @param default_models [Boolean] If the default parameter isn't specified, the service will return all models
350
- # (default and non-default) for each language pair. To return only default models,
351
- # set this to `true`. To return only non-default models, set this to `false`. There
352
- # is exactly one default model per language pair, the IBM provided base model.
387
+ # @!method list_documents
388
+ # List documents.
389
+ # Lists documents that have been submitted for translation.
353
390
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
354
- def list_models(source: nil, target: nil, default_models: nil)
391
+ def list_documents
355
392
  headers = {
356
393
  }
357
- sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_models")
394
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_documents")
358
395
  headers.merge!(sdk_headers)
359
396
 
360
397
  params = {
361
- "version" => @version,
362
- "source" => source,
363
- "target" => target,
364
- "default" => default_models
398
+ "version" => @version
365
399
  }
366
400
 
367
- method_url = "/v3/models"
401
+ method_url = "/v3/documents"
402
+
403
+ response = request(
404
+ method: "GET",
405
+ url: method_url,
406
+ headers: headers,
407
+ params: params,
408
+ accept_json: true
409
+ )
410
+ response
411
+ end
412
+
413
+ ##
414
+ # @!method translate_document(file:, filename: nil, file_content_type: nil, model_id: nil, source: nil, target: nil, document_id: nil)
415
+ # Translate document.
416
+ # Submit a document for translation. You can submit the document contents in the
417
+ # `file` parameter, or you can reference a previously submitted document by document
418
+ # ID.
419
+ # @param file [File] The source file to translate.
420
+ #
421
+ # [Supported file
422
+ # types](https://cloud.ibm.com/docs/services/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats)
423
+ #
424
+ # Maximum file size: **20 MB**.
425
+ # @param filename [String] The filename for file.
426
+ # @param file_content_type [String] The content type of file.
427
+ # @param model_id [String] The model to use for translation. `model_id` or both `source` and `target` are
428
+ # required.
429
+ # @param source [String] Language code that specifies the language of the source document.
430
+ # @param target [String] Language code that specifies the target language for translation.
431
+ # @param document_id [String] To use a previously submitted document as the source for a new translation, enter
432
+ # the `document_id` of the document.
433
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
434
+ def translate_document(file:, filename: nil, file_content_type: nil, model_id: nil, source: nil, target: nil, document_id: nil)
435
+ raise ArgumentError.new("file must be provided") if file.nil?
436
+ raise ArgumentError.new("filename must be provided") if filename.nil?
437
+
438
+ headers = {
439
+ }
440
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "translate_document")
441
+ headers.merge!(sdk_headers)
442
+
443
+ params = {
444
+ "version" => @version
445
+ }
446
+
447
+ form_data = {}
448
+
449
+ unless file.instance_of?(StringIO) || file.instance_of?(File)
450
+ file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
451
+ end
452
+ filename = file.path if filename.nil? && file.respond_to?(:path)
453
+ form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename)
454
+
455
+ form_data[:model_id] = HTTP::FormData::Part.new(model_id.to_s, content_type: "text/plain") unless model_id.nil?
456
+
457
+ form_data[:source] = HTTP::FormData::Part.new(source.to_s, content_type: "text/plain") unless source.nil?
458
+
459
+ form_data[:target] = HTTP::FormData::Part.new(target.to_s, content_type: "text/plain") unless target.nil?
460
+
461
+ form_data[:document_id] = HTTP::FormData::Part.new(document_id.to_s, content_type: "text/plain") unless document_id.nil?
462
+
463
+ method_url = "/v3/documents"
464
+
465
+ response = request(
466
+ method: "POST",
467
+ url: method_url,
468
+ headers: headers,
469
+ params: params,
470
+ form: form_data,
471
+ accept_json: true
472
+ )
473
+ response
474
+ end
475
+
476
+ ##
477
+ # @!method get_document_status(document_id:)
478
+ # Get document status.
479
+ # Gets the translation status of a document.
480
+ # @param document_id [String] The document ID of the document.
481
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
482
+ def get_document_status(document_id:)
483
+ raise ArgumentError.new("document_id must be provided") if document_id.nil?
484
+
485
+ headers = {
486
+ }
487
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "get_document_status")
488
+ headers.merge!(sdk_headers)
489
+
490
+ params = {
491
+ "version" => @version
492
+ }
493
+
494
+ method_url = "/v3/documents/%s" % [ERB::Util.url_encode(document_id)]
495
+
496
+ response = request(
497
+ method: "GET",
498
+ url: method_url,
499
+ headers: headers,
500
+ params: params,
501
+ accept_json: true
502
+ )
503
+ response
504
+ end
505
+
506
+ ##
507
+ # @!method delete_document(document_id:)
508
+ # Delete document.
509
+ # Deletes a document.
510
+ # @param document_id [String] Document ID of the document to delete.
511
+ # @return [nil]
512
+ def delete_document(document_id:)
513
+ raise ArgumentError.new("document_id must be provided") if document_id.nil?
514
+
515
+ headers = {
516
+ }
517
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "delete_document")
518
+ headers.merge!(sdk_headers)
519
+
520
+ params = {
521
+ "version" => @version
522
+ }
523
+
524
+ method_url = "/v3/documents/%s" % [ERB::Util.url_encode(document_id)]
525
+
526
+ request(
527
+ method: "DELETE",
528
+ url: method_url,
529
+ headers: headers,
530
+ params: params,
531
+ accept_json: false
532
+ )
533
+ nil
534
+ end
535
+
536
+ ##
537
+ # @!method get_translated_document(document_id:, accept: nil)
538
+ # Get translated document.
539
+ # Gets the translated document associated with the given document ID.
540
+ # @param document_id [String] The document ID of the document that was submitted for translation.
541
+ # @param accept [String] The type of the response: application/powerpoint, application/mspowerpoint,
542
+ # application/x-rtf, application/json, application/xml, application/vnd.ms-excel,
543
+ # application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
544
+ # application/vnd.ms-powerpoint,
545
+ # application/vnd.openxmlformats-officedocument.presentationml.presentation,
546
+ # application/msword,
547
+ # application/vnd.openxmlformats-officedocument.wordprocessingml.document,
548
+ # application/vnd.oasis.opendocument.spreadsheet,
549
+ # application/vnd.oasis.opendocument.presentation,
550
+ # application/vnd.oasis.opendocument.text, application/pdf, application/rtf,
551
+ # text/html, text/json, text/plain, text/richtext, text/rtf, or text/xml. A
552
+ # character encoding can be specified by including a `charset` parameter. For
553
+ # example, 'text/html;charset=utf-8'.
554
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
555
+ def get_translated_document(document_id:, accept: nil)
556
+ raise ArgumentError.new("document_id must be provided") if document_id.nil?
557
+
558
+ headers = {
559
+ "Accept" => accept
560
+ }
561
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "get_translated_document")
562
+ headers.merge!(sdk_headers)
563
+
564
+ params = {
565
+ "version" => @version
566
+ }
567
+
568
+ method_url = "/v3/documents/%s/translated_document" % [ERB::Util.url_encode(document_id)]
368
569
 
369
570
  response = request(
370
571
  method: "GET",
@@ -38,16 +38,16 @@ module IBMWatson
38
38
  # @param args [Hash] The args to initialize with
39
39
  # @option args url [String] The base url to use when contacting the service (e.g.
40
40
  # "https://gateway.watsonplatform.net/natural-language-classifier/api").
41
- # The base url may differ between Bluemix regions.
41
+ # The base url may differ between IBM Cloud regions.
42
42
  # @option args username [String] The username used to authenticate with the service.
43
43
  # Username and password credentials are only required to run your
44
- # application locally or outside of Bluemix. When running on
45
- # Bluemix, the credentials will be automatically loaded from the
44
+ # application locally or outside of IBM Cloud. When running on
45
+ # IBM Cloud, the credentials will be automatically loaded from the
46
46
  # `VCAP_SERVICES` environment variable.
47
47
  # @option args password [String] The password used to authenticate with the service.
48
48
  # Username and password credentials are only required to run your
49
- # application locally or outside of Bluemix. When running on
50
- # Bluemix, the credentials will be automatically loaded from the
49
+ # application locally or outside of IBM Cloud. When running on
50
+ # IBM Cloud, the credentials will be automatically loaded from the
51
51
  # `VCAP_SERVICES` environment variable.
52
52
  # @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
53
53
  # this API key is provided, the SDK will manage the token and handle the
@@ -57,7 +57,9 @@ module IBMWatson
57
57
  # it expires or reactively upon receiving a 401 from the service as any requests
58
58
  # made with an expired token will fail.
59
59
  # @option args iam_url [String] An optional URL for the IAM service API. Defaults to
60
- # 'https://iam.ng.bluemix.net/identity/token'.
60
+ # 'https://iam.cloud.ibm.com/identity/token'.
61
+ # @option args iam_client_id [String] An optional client id for the IAM service API.
62
+ # @option args iam_client_secret [String] An optional client secret for the IAM service API.
61
63
  def initialize(args = {})
62
64
  @__async_initialized__ = false
63
65
  defaults = {}
@@ -67,6 +69,8 @@ module IBMWatson
67
69
  defaults[:iam_apikey] = nil
68
70
  defaults[:iam_access_token] = nil
69
71
  defaults[:iam_url] = nil
72
+ defaults[:iam_client_id] = nil
73
+ defaults[:iam_client_secret] = nil
70
74
  args = defaults.merge(args)
71
75
  args[:vcap_services_name] = "natural_language_classifier"
72
76
  super
@@ -164,7 +168,7 @@ module IBMWatson
164
168
  # (`pt`), and Spanish (`es`).
165
169
  # @param training_data [File] Training data in CSV format. Each text value must have at least one class. The
166
170
  # data can include up to 3,000 classes and 20,000 records. For details, see [Data
167
- # preparation](https://cloud.ibm.com/docs/services/natural-language-classifier/using-your-data.html).
171
+ # preparation](https://cloud.ibm.com/docs/services/natural-language-classifier?topic=natural-language-classifier-using-your-data).
168
172
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
169
173
  def create_classifier(metadata:, training_data:)
170
174
  raise ArgumentError.new("metadata must be provided") if metadata.nil?
@@ -201,27 +205,25 @@ module IBMWatson
201
205
  end
202
206
 
203
207
  ##
204
- # @!method delete_classifier(classifier_id:)
205
- # Delete classifier.
206
- # @param classifier_id [String] Classifier ID to delete.
207
- # @return [nil]
208
- def delete_classifier(classifier_id:)
209
- raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
210
-
208
+ # @!method list_classifiers
209
+ # List classifiers.
210
+ # Returns an empty array if no classifiers are available.
211
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
212
+ def list_classifiers
211
213
  headers = {
212
214
  }
213
- sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "delete_classifier")
215
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "list_classifiers")
214
216
  headers.merge!(sdk_headers)
215
217
 
216
- method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
218
+ method_url = "/v1/classifiers"
217
219
 
218
- request(
219
- method: "DELETE",
220
+ response = request(
221
+ method: "GET",
220
222
  url: method_url,
221
223
  headers: headers,
222
224
  accept_json: true
223
225
  )
224
- nil
226
+ response
225
227
  end
226
228
 
227
229
  ##
@@ -250,25 +252,27 @@ module IBMWatson
250
252
  end
251
253
 
252
254
  ##
253
- # @!method list_classifiers
254
- # List classifiers.
255
- # Returns an empty array if no classifiers are available.
256
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
257
- def list_classifiers
255
+ # @!method delete_classifier(classifier_id:)
256
+ # Delete classifier.
257
+ # @param classifier_id [String] Classifier ID to delete.
258
+ # @return [nil]
259
+ def delete_classifier(classifier_id:)
260
+ raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
261
+
258
262
  headers = {
259
263
  }
260
- sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "list_classifiers")
264
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "delete_classifier")
261
265
  headers.merge!(sdk_headers)
262
266
 
263
- method_url = "/v1/classifiers"
267
+ method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
264
268
 
265
- response = request(
266
- method: "GET",
269
+ request(
270
+ method: "DELETE",
267
271
  url: method_url,
268
272
  headers: headers,
269
273
  accept_json: true
270
274
  )
271
- response
275
+ nil
272
276
  end
273
277
  end
274
278
  end
@@ -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/services/natural-language-understanding/customizing.html)
23
+ # models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing)
24
24
  # with Watson Knowledge Studio to detect custom entities, relations, and categories in
25
25
  # Natural Language Understanding.
26
26
 
@@ -53,16 +53,16 @@ module IBMWatson
53
53
  # ready for a later version.
54
54
  # @option args url [String] The base url to use when contacting the service (e.g.
55
55
  # "https://gateway.watsonplatform.net/natural-language-understanding/api").
56
- # The base url may differ between Bluemix regions.
56
+ # The base url may differ between IBM Cloud regions.
57
57
  # @option args username [String] The username used to authenticate with the service.
58
58
  # Username and password credentials are only required to run your
59
- # application locally or outside of Bluemix. When running on
60
- # Bluemix, the credentials will be automatically loaded from the
59
+ # application locally or outside of IBM Cloud. When running on
60
+ # IBM Cloud, the credentials will be automatically loaded from the
61
61
  # `VCAP_SERVICES` environment variable.
62
62
  # @option args password [String] The password used to authenticate with the service.
63
63
  # Username and password credentials are only required to run your
64
- # application locally or outside of Bluemix. When running on
65
- # Bluemix, the credentials will be automatically loaded from the
64
+ # application locally or outside of IBM Cloud. When running on
65
+ # IBM Cloud, the credentials will be automatically loaded from the
66
66
  # `VCAP_SERVICES` environment variable.
67
67
  # @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
68
68
  # this API key is provided, the SDK will manage the token and handle the
@@ -72,7 +72,9 @@ module IBMWatson
72
72
  # it expires or reactively upon receiving a 401 from the service as any requests
73
73
  # made with an expired token will fail.
74
74
  # @option args iam_url [String] An optional URL for the IAM service API. Defaults to
75
- # 'https://iam.ng.bluemix.net/identity/token'.
75
+ # 'https://iam.cloud.ibm.com/identity/token'.
76
+ # @option args iam_client_id [String] An optional client id for the IAM service API.
77
+ # @option args iam_client_secret [String] An optional client secret for the IAM service API.
76
78
  def initialize(args = {})
77
79
  @__async_initialized__ = false
78
80
  defaults = {}
@@ -83,6 +85,8 @@ module IBMWatson
83
85
  defaults[:iam_apikey] = nil
84
86
  defaults[:iam_access_token] = nil
85
87
  defaults[:iam_url] = nil
88
+ defaults[:iam_client_id] = nil
89
+ defaults[:iam_client_secret] = nil
86
90
  args = defaults.merge(args)
87
91
  args[:vcap_services_name] = "natural-language-understanding"
88
92
  super
@@ -117,10 +121,10 @@ module IBMWatson
117
121
  # required.
118
122
  # @param clean [Boolean] Set this to `false` to disable webpage cleaning. To learn more about webpage
119
123
  # cleaning, see the [Analyzing
120
- # webpages](https://cloud.ibm.com/docs/services/natural-language-understanding/analyzing-webpages.html)
124
+ # webpages](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages)
121
125
  # documentation.
122
126
  # @param xpath [String] An [XPath
123
- # query](https://cloud.ibm.com/docs/services/natural-language-understanding/analyzing-webpages.html#xpath)
127
+ # query](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages#xpath)
124
128
  # to perform on `html` or `url` input. Results of the query will be appended to the
125
129
  # cleaned webpage text before it is analyzed. To analyze only the results of the
126
130
  # XPath query, set the `clean` parameter to `false`.
@@ -129,7 +133,7 @@ module IBMWatson
129
133
  # @param language [String] ISO 639-1 code that specifies the language of your text. This overrides automatic
130
134
  # language detection. Language support differs depending on the features you include
131
135
  # in your analysis. See [Language
132
- # support](https://www.bluemix.net/docs/services/natural-language-understanding/language-support.html)
136
+ # support](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-language-support)
133
137
  # for more information.
134
138
  # @param limit_text_characters [Fixnum] Sets the maximum number of characters that are processed by the service.
135
139
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
@@ -175,27 +179,26 @@ module IBMWatson
175
179
  #########################
176
180
 
177
181
  ##
178
- # @!method delete_model(model_id:)
179
- # Delete model.
180
- # Deletes a custom model.
181
- # @param model_id [String] Model ID of the model to delete.
182
+ # @!method list_models
183
+ # List models.
184
+ # Lists Watson Knowledge Studio [custom entities and relations
185
+ # models](https://cloud.ibm.com/docs/services/natural-language-understanding?topic=natural-language-understanding-customizing)
186
+ # that are deployed to your Natural Language Understanding service.
182
187
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
183
- def delete_model(model_id:)
184
- raise ArgumentError.new("model_id must be provided") if model_id.nil?
185
-
188
+ def list_models
186
189
  headers = {
187
190
  }
188
- sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "delete_model")
191
+ sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "list_models")
189
192
  headers.merge!(sdk_headers)
190
193
 
191
194
  params = {
192
195
  "version" => @version
193
196
  }
194
197
 
195
- method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
198
+ method_url = "/v1/models"
196
199
 
197
200
  response = request(
198
- method: "DELETE",
201
+ method: "GET",
199
202
  url: method_url,
200
203
  headers: headers,
201
204
  params: params,
@@ -205,26 +208,27 @@ module IBMWatson
205
208
  end
206
209
 
207
210
  ##
208
- # @!method list_models
209
- # List models.
210
- # Lists Watson Knowledge Studio [custom
211
- # models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
212
- # that are deployed to your Natural Language Understanding service.
211
+ # @!method delete_model(model_id:)
212
+ # Delete model.
213
+ # Deletes a custom model.
214
+ # @param model_id [String] Model ID of the model to delete.
213
215
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
214
- def list_models
216
+ def delete_model(model_id:)
217
+ raise ArgumentError.new("model_id must be provided") if model_id.nil?
218
+
215
219
  headers = {
216
220
  }
217
- sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "list_models")
221
+ sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "delete_model")
218
222
  headers.merge!(sdk_headers)
219
223
 
220
224
  params = {
221
225
  "version" => @version
222
226
  }
223
227
 
224
- method_url = "/v1/models"
228
+ method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
225
229
 
226
230
  response = request(
227
- method: "GET",
231
+ method: "DELETE",
228
232
  url: method_url,
229
233
  headers: headers,
230
234
  params: params,