Skip to content

Commit 172f82b

Browse files
committed
doc full
1 parent ea1ddb8 commit 172f82b

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

services/language_translation/v2.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,33 @@
7676
</script>
7777

7878
<script type="text/x-red" data-help-name="watson-translate">
79-
<p>The Language Translation service enables you to translate text from one language to another.</p>
79+
<p>The Language Translation service enables you to translate text from one language to another and to add your own translation models.</p>
80+
<p></p>
81+
<p><b>Translation Mode</b>.</p>
8082
<p>The text to translate should be passed in on <code>msg.payload</code>.</p>
8183
<p>The translated text will be returned on <code>msg.payload</code>.</p>
8284
<p>Source and destination language parameters can be configured through the editor panel or set dynamically using
8385
the language codes in the following properties, <code>msg.srclang</code> and <code>msg.destlang</code>. Please see
8486
the documentation linked below for the currently supported source and destination language codes.</p>
87+
<p></p>
88+
<p><b>Training Mode</b>.</p>
89+
<p>This mode enables you to add your own customized model to the Watson translation service. </p>
90+
<p>In the Dropbox node, you must specify one ore more of the following file options to customize the training:</p>
91+
<p>forced_glossary - A UTF-8 encoded TMX file that contains pairs of matching terms in the source and target language that are seen as absolute by the system. This file completely overwrites the original domain data.</p>
92+
<p>parallel_corpus - A UTF-8 encoded TMX file that contains matching phrases in the source and target language that serve as examples for Watson. Parallel corpora differ from glossaries because they do not overwrite the original domain data.</p>
93+
<p>monolingual_corpus - A UTF-8 encoded plain text file that contains a body of text in the target language that is related to what you are translating. A monolingual corpus helps improve literal translations to be more fluent and human.</p>
94+
<p>The Language Translation Node will return the ID of the created customized model.</p>
95+
<p></p>
96+
<p><b>Get Status Mode</b>.</p>
97+
<p>This mode allows you to get the status of a model sent to training by providing its ID.</p>
98+
<p>Values can be the followings:</p>
99+
<p>training - Training is still in progress.</p>
100+
<p>queued@<#> - Training has not yet started and the model is in the queue. The # indicates the number of your model in the queue.</p>
101+
<p>error - Training did not complete because of an error.</p>
102+
<p>available - Training is completed, and the service is now available to use with your custom translation model.</p>
103+
<p><b>Delete Mode</b>.</p>
104+
<p></p>
105+
<p>This mode allows you to delete a model by providing its ID</p>
85106
<p>For more information about the Language Translation service, read the <a href="http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/language-translation.html">documentation</a>.</p>
86107
</script>
87108

services/language_translation/v2.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ module.exports = function (RED) {
100100
};
101101

102102
this.doTrain = function (msg, basemodel, filetype) {
103-
console.log(basemodel);
104103
language_translation = watson.language_translation({
105104
username: username,
106105
password: password,
@@ -169,7 +168,6 @@ module.exports = function (RED) {
169168
}
170169

171170
this.doGetStatus = function(msg, trainid) {
172-
console.log('getstatus');
173171
language_translation = watson.language_translation({
174172
username: username,
175173
password: password,
@@ -186,15 +184,13 @@ module.exports = function (RED) {
186184
function(err, model) {
187185
node.status({});
188186
if (err) {
189-
console.log('failed');
190187
node.status({
191188
fill: 'red',
192189
shape: 'ring',
193190
text: 'call to translation service failed'
194191
});
195192
node.error(err, msg);
196193
} else {
197-
console.log('did not fail');
198194
msg.payload = model.status;
199195
node.send(msg);
200196
node.status({});
@@ -204,7 +200,6 @@ module.exports = function (RED) {
204200
}
205201

206202
this.doDelete = function(msg, trainid) {
207-
console.log('do delete');
208203
language_translation = watson.language_translation({
209204
username: username,
210205
password: password,
@@ -217,19 +212,17 @@ module.exports = function (RED) {
217212
text: 'deleting'
218213
});
219214

220-
language_translation.deleteModel({ model_id:'{model_id}'},
215+
language_translation.deleteModel({ model_id: trainid},
221216
function(err) {
222217
node.status({});
223218
if (err) {
224-
console.log('failed');
225219
node.status({
226220
fill: 'red',
227221
shape: 'ring',
228222
text: 'could not delete'
229223
});
230224
node.error(err, msg);
231225
} else {
232-
console.log('did not fail');
233226
msg.payload = "model deleted";
234227
node.send(msg);
235228
node.status({});
@@ -316,7 +309,6 @@ module.exports = function (RED) {
316309
} else {
317310
model_id = srclang + '-' + destlang + '-' + domain;
318311
}
319-
console.log('switch', action);
320312
switch (action) {
321313
case 'translate':
322314
this.doTranslate(msg, model_id);

0 commit comments

Comments
 (0)