From 2676798211fe65bb972107907df5c4febe813d27 Mon Sep 17 00:00:00 2001 From: German Attanasio Date: Mon, 20 Apr 2020 12:21:33 -0400 Subject: [PATCH] feat(language-translator): auto-generate code --- .../v3/LanguageTranslator.java | 4 ++- .../v3/model/DocumentStatus.java | 17 +++++++++++ .../v3/model/TranslateDocumentOptions.java | 8 +++-- .../v3/model/TranslateOptions.java | 10 +++++-- .../v3/model/TranslationResult.java | 30 +++++++++++++++++++ 5 files changed, 63 insertions(+), 6 deletions(-) diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java index b9f5626cf26..e33e069fc9f 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java @@ -121,7 +121,9 @@ public LanguageTranslator(String versionDate, String serviceName, Authenticator /** * Translate. * - *

Translates the input text from the source language to the target language. + *

Translates the input text from the source language to the target language. A target language + * or translation model ID is required. The service attempts to detect the language of the source + * text if it is not specified. * * @param translateOptions the {@link TranslateOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TranslationResult} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java index 3e0ef9c216c..415814d0fa5 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/DocumentStatus.java @@ -42,6 +42,10 @@ public interface Status { protected String baseModelId; protected String source; + + @SerializedName("detected_language_confidence") + protected Double detectedLanguageConfidence; + protected String target; protected Date created; protected Date completed; @@ -121,6 +125,19 @@ public String getSource() { return source; } + /** + * Gets the detectedLanguageConfidence. + * + *

A score between 0 and 1 indicating the confidence of source language detection. A higher + * value indicates greater confidence. This is returned only when the service automatically + * detects the source language. + * + * @return the detectedLanguageConfidence + */ + public Double getDetectedLanguageConfidence() { + return detectedLanguageConfidence; + } + /** * Gets the target. * diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java index b829e18e620..a7d607e1d37 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java @@ -226,7 +226,10 @@ public String fileContentType() { /** * Gets the modelId. * - *

The model to use for translation. `model_id` or both `source` and `target` are required. + *

The model to use for translation. For example, `en-de` selects the IBM provided base model + * for English to German translation. A model ID overrides the source and target parameters and is + * required if you use a custom model. If no model ID is specified, you must specify a target + * language. * * @return the modelId */ @@ -248,7 +251,8 @@ public String source() { /** * Gets the target. * - *

Language code that specifies the target language for translation. + *

Language code that specifies the target language for translation. Required if model ID is + * not specified. * * @return the target */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java index fdbe1dc7eae..7daf739e250 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java @@ -151,7 +151,10 @@ public List text() { /** * Gets the modelId. * - *

A globally unique string that identifies the underlying model that is used for translation. + *

The model to use for translation. For example, `en-de` selects the IBM provided base model + * for English to German translation. A model ID overrides the source and target parameters and is + * required if you use a custom model. If no model ID is specified, you must specify a target + * language. * * @return the modelId */ @@ -162,7 +165,7 @@ public String modelId() { /** * Gets the source. * - *

Translation source language code. + *

Language code that specifies the language of the source document. * * @return the source */ @@ -173,7 +176,8 @@ public String source() { /** * Gets the target. * - *

Translation target language code. + *

Language code that specifies the target language for translation. Required if model ID is + * not specified. * * @return the target */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java index 01544aee570..fe7b44519c5 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslationResult.java @@ -25,6 +25,12 @@ public class TranslationResult extends GenericModel { @SerializedName("character_count") protected Long characterCount; + @SerializedName("detected_language") + protected String detectedLanguage; + + @SerializedName("detected_language_confidence") + protected Double detectedLanguageConfidence; + protected List translations; /** @@ -49,6 +55,30 @@ public Long getCharacterCount() { return characterCount; } + /** + * Gets the detectedLanguage. + * + *

The language code of the source text if the source language was automatically detected. + * + * @return the detectedLanguage + */ + public String getDetectedLanguage() { + return detectedLanguage; + } + + /** + * Gets the detectedLanguageConfidence. + * + *

A score between 0 and 1 indicating the confidence of source language detection. A higher + * value indicates greater confidence. This is returned only when the service automatically + * detects the source language. + * + * @return the detectedLanguageConfidence + */ + public Double getDetectedLanguageConfidence() { + return detectedLanguageConfidence; + } + /** * Gets the translations. *