IdentifiedLanguage

  • IdentifiedLanguage objects represent languages identified by the ML Kit Language Identifier.

  • Each IdentifiedLanguage has a language tag (BCP 47 format), a confidence score, and methods for comparison and hashing.

  • Confidence scores range from 0 to 1, reflecting the likelihood of the identified language being correct.

  • If no language is detected, the language tag will be LanguageIdentifier.UNDETERMINED_LANGUAGE_TAG.

public final class IdentifiedLanguage extends Object

Public Method Summary

boolean
equals(Object o)
Indicates whether some other object is "equal to" this one.
float
getConfidence()
Returns the confidence score associated with the language.
String
getLanguageTag()
Returns the BCP 47 language tag for the language.
int
hashCode()
Returns a hash code value for the object.
String

Inherited Method Summary

Public Methods

public boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

public float getConfidence ()

Returns the confidence score associated with the language. The value is between 0 and 1, and greater or equal to the confidence threshold specified for LanguageIdentifier.identifyPossibleLanguages(String) in LanguageIdentificationOptions.

public String getLanguageTag ()

Returns the BCP 47 language tag for the language.

Returns LanguageIdentifier.UNDETERMINED_LANGUAGE_TAG if no language is detected.

public int hashCode ()

Returns a hash code value for the object.

public String toString ()