Skip to content

Commit

Permalink
feat(language-translator): auto-generate code
Browse files Browse the repository at this point in the history
  • Loading branch information
germanattanasio committed Apr 23, 2020
1 parent 9812072 commit 2676798
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public LanguageTranslator(String versionDate, String serviceName, Authenticator
/**
* Translate.
*
* <p>Translates the input text from the source language to the target language.
* <p>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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -121,6 +125,19 @@ public String getSource() {
return source;
}

/**
* Gets the detectedLanguageConfidence.
*
* <p>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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ public String fileContentType() {
/**
* Gets the modelId.
*
* <p>The model to use for translation. `model_id` or both `source` and `target` are required.
* <p>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
*/
Expand All @@ -248,7 +251,8 @@ public String source() {
/**
* Gets the target.
*
* <p>Language code that specifies the target language for translation.
* <p>Language code that specifies the target language for translation. Required if model ID is
* not specified.
*
* @return the target
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ public List<String> text() {
/**
* Gets the modelId.
*
* <p>A globally unique string that identifies the underlying model that is used for translation.
* <p>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
*/
Expand All @@ -162,7 +165,7 @@ public String modelId() {
/**
* Gets the source.
*
* <p>Translation source language code.
* <p>Language code that specifies the language of the source document.
*
* @return the source
*/
Expand All @@ -173,7 +176,8 @@ public String source() {
/**
* Gets the target.
*
* <p>Translation target language code.
* <p>Language code that specifies the target language for translation. Required if model ID is
* not specified.
*
* @return the target
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Translation> translations;

/**
Expand All @@ -49,6 +55,30 @@ public Long getCharacterCount() {
return characterCount;
}

/**
* Gets the detectedLanguage.
*
* <p>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.
*
* <p>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.
*
Expand Down

0 comments on commit 2676798

Please sign in to comment.