From 55ca49ea948f0b3f80cae374b6f774eadd7b6edd Mon Sep 17 00:00:00 2001 From: Puneith Kaul Date: Mon, 14 Nov 2016 19:34:05 -0800 Subject: [PATCH 1/3] added model parameter --- translate/README.md | 2 +- translate/pom.xml | 4 ++-- .../com/google/cloud/translate/samples/TranslateText.java | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/translate/README.md b/translate/README.md index 359a6a47da0..fed65c2f5a7 100644 --- a/translate/README.md +++ b/translate/README.md @@ -47,7 +47,7 @@ We can then run the assembled JAR file with the `java` command. The variable $COMMAND takes three values `langsupport`, `detect` and `translate`. ``` -JAR_FILE=target/translate-1.0-SNAPSHOT-jar-with-dependencies.jar +JAR_FILE=target/translate-1.0-jar-with-dependencies.jar java -jar $JAR_FILE ``` diff --git a/translate/pom.xml b/translate/pom.xml index 12d39bab032..0f59435edea 100644 --- a/translate/pom.xml +++ b/translate/pom.xml @@ -17,7 +17,7 @@ limitations under the License. 4.0.0 com.google.cloud.translate.samples translate - 1.0-SNAPSHOT + 1.0 translate http://maven.apache.org @@ -38,7 +38,7 @@ limitations under the License. com.google.cloud google-cloud-translate - 0.5.1 + 0.6.0 junit diff --git a/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java b/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java index 90e8cb20930..049be83a497 100644 --- a/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java +++ b/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java @@ -77,7 +77,10 @@ public static void translateTextWithOptions( TranslateOption srcLang = TranslateOption.sourceLanguage(sourceLang); TranslateOption tgtLang = TranslateOption.targetLanguage(targetLang); - Translation translation = translate.translate(sourceText, srcLang, tgtLang); + //Use translate `model` parameter with `base` and `nmt` options + TranslateOption model = TranslateOption.model("nmt"); + + Translation translation = translate.translate(sourceText, srcLang, tgtLang, model); out.printf("Source Text:\n\tLang: %s, Text: %s\n", sourceLang, sourceText); out.printf("TranslatedText:\n\tLang: %s, Text: %s\n", targetLang, translation.translatedText()); } From 25ab15ae761e8a182374336d76c696ee83566631 Mon Sep 17 00:00:00 2001 From: Puneith Kaul Date: Mon, 14 Nov 2016 19:35:17 -0800 Subject: [PATCH 2/3] changed to base model --- .../java/com/google/cloud/translate/samples/TranslateText.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java b/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java index 049be83a497..d8f26564394 100644 --- a/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java +++ b/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java @@ -78,7 +78,7 @@ public static void translateTextWithOptions( TranslateOption tgtLang = TranslateOption.targetLanguage(targetLang); //Use translate `model` parameter with `base` and `nmt` options - TranslateOption model = TranslateOption.model("nmt"); + TranslateOption model = TranslateOption.model("base"); Translation translation = translate.translate(sourceText, srcLang, tgtLang, model); out.printf("Source Text:\n\tLang: %s, Text: %s\n", sourceLang, sourceText); From 78dfdadd157aa3182fe0acb7a6ffa9cdcdfa4124 Mon Sep 17 00:00:00 2001 From: Puneith Kaul Date: Mon, 14 Nov 2016 20:56:39 -0800 Subject: [PATCH 3/3] added space after comment --- .../java/com/google/cloud/translate/samples/TranslateText.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java b/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java index d8f26564394..823ead3a37d 100644 --- a/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java +++ b/translate/src/main/java/com/google/cloud/translate/samples/TranslateText.java @@ -77,7 +77,7 @@ public static void translateTextWithOptions( TranslateOption srcLang = TranslateOption.sourceLanguage(sourceLang); TranslateOption tgtLang = TranslateOption.targetLanguage(targetLang); - //Use translate `model` parameter with `base` and `nmt` options + // Use translate `model` parameter with `base` and `nmt` options. TranslateOption model = TranslateOption.model("base"); Translation translation = translate.translate(sourceText, srcLang, tgtLang, model);