# Class LanguageIdentifier

java.lang.Object
com.codename1.ai.language.LanguageIdentifier

public final class LanguageIdentifier extends Object
Identifies possible languages entirely on device. Results are ranked by descending backend confidence and filtered by `LanguageOptions.getMinimumConfidence()`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `LanguageIdentifier.Session`
  Reusable owner of a native language-identification backend.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static AsyncResource<LanguageCandidate[]>`
  `identify(String text, LanguageOptions options)`
  Identifies possible languages off the EDT without uploading text.
  `static boolean`
  `isSupported()`
  `static boolean`
  `isSupported(LanguageOptions options)`
  `static LanguageIdentifier.Session`
  `open(LanguageOptions options)`
  Opens a reusable language-identification session.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### isSupported

    public static boolean isSupported()
    Returns:
      whether automatic language identification is available

  - ### isSupported

    public static boolean isSupported(LanguageOptions options)
    Parameters:
      `options` - backend selection, or `null` for defaults
    Returns:
      whether the selected backend is available on this target

  - ### open

    public static LanguageIdentifier.Session open(LanguageOptions options)
    Opens a reusable language-identification session. Reusing a session avoids repeatedly creating the native recognizer when classifying many strings. Close it when no more identifications are pending.
    Parameters:
      `options` - backend and confidence options, or `null`
    Returns:
      a reusable session that owns one native language backend
    Throws:
      `UnsupportedOperationException` - if the selected backend is absent

  - ### identify

    public static AsyncResource<LanguageCandidate[]> identify(String text, LanguageOptions options)
    Identifies possible languages off the EDT without uploading text. The option values are copied before the backend starts, so later mutations of the supplied object cannot alter the pending identification. Cancelling the returned resource suppresses late result callbacks; the temporary backend is released after its pending native work settles.
    Parameters:
      `text` - non-null text to classify
      `options` - backend and confidence options, or `null`
    Returns:
      asynchronous ranked candidates; may be empty for undetermined text