TranslationText Class

  • java.lang.Object
    • com.azure.ai.translation.text.models.TranslationText

Implements

public final class TranslationText
implements JsonSerializable<TranslationText>

Translation result.

Method Summary

Modifier and Type Method and Description
static TranslationText fromJson(JsonReader jsonReader)

Reads an instance of TranslationText from the JsonReader.

Integer getInstructionTokenCount()

Get the instructionTokenCount property: An integer indicating the number of tokens used in generating the translated text.

String getLanguage()

Get the language property: A string representing the language code of the target language.

Integer getResponseTokenCount()

Get the responseTokenCount property: An integer indicating the number of tokens used in the translation response.

Integer getSourceCharacterCount()

Get the sourceCharacterCount property: An integer indicating the number of characters in the source text string.

Integer getSourceTokenCount()

Get the sourceTokenCount property: An integer indicating the number of tokens used in the source sentence.

Integer getTargetTokenCount()

Get the targetTokenCount property: An integer indicating the number of tokens used in the target sentence.

String getText()

Get the text property: A string giving the translated text.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Method Details

fromJson

public static TranslationText fromJson(JsonReader jsonReader)

Reads an instance of TranslationText from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of TranslationText if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getInstructionTokenCount

public Integer getInstructionTokenCount()

Get the instructionTokenCount property: An integer indicating the number of tokens used in generating the translated text.

Returns:

the instructionTokenCount value.

getLanguage

public String getLanguage()

Get the language property: A string representing the language code of the target language.

Returns:

the language value.

getResponseTokenCount

public Integer getResponseTokenCount()

Get the responseTokenCount property: An integer indicating the number of tokens used in the translation response.

Returns:

the responseTokenCount value.

getSourceCharacterCount

public Integer getSourceCharacterCount()

Get the sourceCharacterCount property: An integer indicating the number of characters in the source text string.

Returns:

the sourceCharacterCount value.

getSourceTokenCount

public Integer getSourceTokenCount()

Get the sourceTokenCount property: An integer indicating the number of tokens used in the source sentence.

Returns:

the sourceTokenCount value.

getTargetTokenCount

public Integer getTargetTokenCount()

Get the targetTokenCount property: An integer indicating the number of tokens used in the target sentence.

Returns:

the targetTokenCount value.

getText

public String getText()

Get the text property: A string giving the translated text.

Returns:

the text value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to