Skip to content

Commit 82f6639

Browse files
Merge pull request #289 from watson-developer-cloud/mdk/language-translator
Eliminate content-type parameters from LT create_model
2 parents bc0a218 + a37b778 commit 82f6639

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

watson_developer_cloud/language_translator_v2.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ def create_model(self,
140140
forced_glossary=None,
141141
parallel_corpus=None,
142142
monolingual_corpus=None,
143-
forced_glossary_content_type=None,
144143
forced_glossary_filename=None,
145-
parallel_corpus_content_type=None,
146144
parallel_corpus_filename=None,
147-
monolingual_corpus_content_type=None,
148145
monolingual_corpus_filename=None):
149146
"""
150147
Uploads a TMX glossary file on top of a domain to customize a translation model.
@@ -154,11 +151,8 @@ def create_model(self,
154151
:param file forced_glossary: A TMX file with your customizations. The customizations in the file completely overwrite the domain data translation, including high frequency or high confidence phrase translations. You can upload only one glossary with a file size less than 10 MB per call.
155152
:param file parallel_corpus: A TMX file that contains entries that are treated as a parallel corpus instead of a glossary.
156153
:param file monolingual_corpus: A UTF-8 encoded plain text file that is used to customize the target language model.
157-
:param str forced_glossary_content_type: The content type of forced_glossary.
158154
:param str forced_glossary_filename: The filename for forced_glossary.
159-
:param str parallel_corpus_content_type: The content type of parallel_corpus.
160155
:param str parallel_corpus_filename: The filename for parallel_corpus.
161-
:param str monolingual_corpus_content_type: The content type of monolingual_corpus.
162156
:param str monolingual_corpus_filename: The filename for monolingual_corpus.
163157
:return: A `dict` containing the `TranslationModel` response.
164158
:rtype: dict
@@ -171,23 +165,23 @@ def create_model(self,
171165
if not forced_glossary_filename and hasattr(forced_glossary,
172166
'name'):
173167
forced_glossary_filename = forced_glossary.name
174-
mime_type = forced_glossary_content_type or 'application/octet-stream'
168+
mime_type = 'application/octet-stream'
175169
forced_glossary_tuple = (forced_glossary_filename, forced_glossary,
176170
mime_type)
177171
parallel_corpus_tuple = None
178172
if parallel_corpus:
179173
if not parallel_corpus_filename and hasattr(parallel_corpus,
180174
'name'):
181175
parallel_corpus_filename = parallel_corpus.name
182-
mime_type = parallel_corpus_content_type or 'application/octet-stream'
176+
mime_type = 'application/octet-stream'
183177
parallel_corpus_tuple = (parallel_corpus_filename, parallel_corpus,
184178
mime_type)
185179
monolingual_corpus_tuple = None
186180
if monolingual_corpus:
187181
if not monolingual_corpus_filename and hasattr(
188182
monolingual_corpus, 'name'):
189183
monolingual_corpus_filename = monolingual_corpus.name
190-
mime_type = monolingual_corpus_content_type or 'application/octet-stream'
184+
mime_type = 'text/plain'
191185
monolingual_corpus_tuple = (monolingual_corpus_filename,
192186
monolingual_corpus, mime_type)
193187
response = self.request(

watson_developer_cloud/natural_language_classifier_v1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def classify(self, classifier_id, text):
9696
def create_classifier(self,
9797
metadata,
9898
training_data,
99-
training_metadata_filename=None,
99+
metadata_filename=None,
100100
training_data_filename=None):
101101
"""
102102
Create classifier.
@@ -106,7 +106,7 @@ def create_classifier(self,
106106
107107
: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).
108108
: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).
109-
:param str training_metadata_filename: The filename for training_metadata.
109+
:param str metadata_filename: The filename for training_metadata.
110110
:param str training_data_filename: The filename for training_data.
111111
:return: A `dict` containing the `Classifier` response.
112112
:rtype: dict
@@ -115,10 +115,10 @@ def create_classifier(self,
115115
raise ValueError('metadata must be provided')
116116
if training_data is None:
117117
raise ValueError('training_data must be provided')
118-
if not training_metadata_filename and hasattr(metadata, 'name'):
119-
training_metadata_filename = metadata.name
118+
if not metadata_filename and hasattr(metadata, 'name'):
119+
metadata_filename = metadata.name
120120
mime_type = 'application/octet-stream'
121-
metadata_tuple = (training_metadata_filename, metadata, mime_type)
121+
metadata_tuple = (metadata_filename, metadata, mime_type)
122122
if not training_data_filename and hasattr(training_data, 'name'):
123123
training_data_filename = training_data.name
124124
mime_type = 'application/octet-stream'

0 commit comments

Comments
 (0)