You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Final pass of codegen for v1.0.0 SDK release (#287)
* Generated Python SDK for multiple services
* Hand-coded changes to create/updateClassifier
* Hand-coded changes to PIV3 profile for text/csv accept type
Copy file name to clipboardExpand all lines: watson_developer_cloud/language_translator_v2.py
+11-77Lines changed: 11 additions & 77 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,8 @@
20
20
your language, communicate with your customers in their own language, and more.
21
21
"""
22
22
23
+
from __future__ importabsolute_import
24
+
23
25
importjson
24
26
from .watson_serviceimportWatsonService
25
27
@@ -525,97 +527,27 @@ def __ne__(self, other):
525
527
returnnotself==other
526
528
527
529
528
-
classTranslateRequest(object):
529
-
"""
530
-
TranslateRequest.
531
-
532
-
:attr list[str] text: Input text in UTF-8 encoding. It is a list so that multiple paragraphs can be submitted. Also accept a single string, instead of an array, as valid input.
533
-
:attr str model_id: (optional) The unique model_id of the translation model being used to translate text. The model_id inherently specifies source language, target language, and domain. If the model_id is specified, there is no need for the source and target parameters and the values are ignored.
534
-
:attr str source: (optional) Used in combination with target as an alternative way to select the model for translation. When target and source are set, and model_id is not set, the system chooses a default model with the right language pair to translate (usually the model based on the news domain).
535
-
:attr str target: (optional) Used in combination with source as an alternative way to select the model for translation. When target and source are set, and model_id is not set, the system chooses a default model with the right language pair to translate (usually the model based on the news domain).
:param list[str] text: Input text in UTF-8 encoding. It is a list so that multiple paragraphs can be submitted. Also accept a single string, instead of an array, as valid input.
543
-
:param str model_id: (optional) The unique model_id of the translation model being used to translate text. The model_id inherently specifies source language, target language, and domain. If the model_id is specified, there is no need for the source and target parameters and the values are ignored.
544
-
:param str source: (optional) Used in combination with target as an alternative way to select the model for translation. When target and source are set, and model_id is not set, the system chooses a default model with the right language pair to translate (usually the model based on the news domain).
545
-
:param str target: (optional) Used in combination with source as an alternative way to select the model for translation. When target and source are set, and model_id is not set, the system chooses a default model with the right language pair to translate (usually the model based on the news domain).
546
-
"""
547
-
self.text=text
548
-
self.model_id=model_id
549
-
self.source=source
550
-
self.target=target
551
-
552
-
@classmethod
553
-
def_from_dict(cls, _dict):
554
-
"""Initialize a TranslateRequest object from a json dictionary."""
555
-
args= {}
556
-
if'text'in_dict:
557
-
args['text'] =_dict['text']
558
-
else:
559
-
raiseValueError(
560
-
'Required property \'text\' not present in TranslateRequest JSON'
561
-
)
562
-
if'model_id'in_dict:
563
-
args['model_id'] =_dict['model_id']
564
-
if'source'in_dict:
565
-
args['source'] =_dict['source']
566
-
if'target'in_dict:
567
-
args['target'] =_dict['target']
568
-
returncls(**args)
569
-
570
-
def_to_dict(self):
571
-
"""Return a json dictionary representing this model."""
:param file metadata: Metadata in JSON format. The metadata identifies the language of the data, and an optional name to identify the classifier. For details, see the [API reference](https://www.ibm.com/watson/developercloud/natural-language-classifier/api/v1/#create_classifier).
109
109
:param file training_data: Training data in CSV format. Each text value must have at least one class. The data can include up to 15,000 records. For details, see [Using your own data](https://www.ibm.com/watson/developercloud/doc/natural-language-classifier/using-your-data.html).
110
-
:param str training_metadata_content_type: The content type of training_metadata.
111
110
:param str training_metadata_filename: The filename for training_metadata.
112
-
:param str training_data_content_type: The content type of training_data.
113
111
:param str training_data_filename: The filename for training_data.
114
112
:return: A `dict` containing the `Classifier` response.
0 commit comments