DetectedLanguage Class

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

Implements

public final class DetectedLanguage
implements JsonSerializable<DetectedLanguage>

An object describing the detected language.

Method Summary

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

Reads an instance of DetectedLanguage from the JsonReader.

String getLanguage()

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

double getScore()

Get the score property: A float value indicating the confidence in the result.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Method Details

fromJson

public static DetectedLanguage fromJson(JsonReader jsonReader)

Reads an instance of DetectedLanguage from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of DetectedLanguage 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.

getLanguage

public String getLanguage()

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

Returns:

the language value.

getScore

public double getScore()

Get the score property: A float value indicating the confidence in the result. The score is between zero and one and a low score indicates a low confidence.

Returns:

the score value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to