# Class TextScript

java.lang.Object
com.codename1.ai.vision.TextScript

public final class TextScript extends Object

Writing system selectors for `TextRecognizer`. The recognizers behind the portable API are script-specific rather than language-specific: one script covers every language written in it, and each script model also recognizes Latin characters embedded in the page.

Each selector call is also a build-time dependency marker, exactly like `VisionBackends`. The methods must remain distinct so a build packages only the script models the application actually asks for; a Japanese OCR application does not carry the Korean or Devanagari model.

    TextRecognizer recognizer = new TextRecognizer(
            new VisionOptions().textScript(TextScript.japanese()));
    recognizer.process(VisionImage.encoded(jpeg)).ready(result -> {
        Log.p(result.getText());
    });

A selector states the script, not the backend. Android maps each one to the matching ML Kit recognizer. Apple platforms map it to the Vision recognition languages for that script, and report the analysis as unsupported when the OS does not recognize that script -- selecting `VisionBackends.mlKitTextRecognition()` then supplies the script model through ML Kit instead.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static TextScript`
  `chinese()`
  Selects the Chinese script, covering Simplified and Traditional Chinese.
  `static TextScript`
  `devanagari()`
  Selects the Devanagari script used by Hindi, Marathi, Nepali and Sanskrit.
  `String`
  `getId()`
  `static TextScript`
  `japanese()`
  Selects the Japanese script, covering kanji, hiragana and katakana.
  `static TextScript`
  `korean()`
  Selects the Korean script, covering hangul and hanja.
  `static TextScript`
  `latin()`
  Selects the Latin script, which is also the platform default.
  `String`
  `toString()`
  Returns a string representation of the object.

  ### Methods inherited from class Object

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

- ## Method Details

  - ### latin

    public static TextScript latin()
    Selects the Latin script, which is also the platform default. Referencing it adds no model beyond the one every text recognizer already carries.
    Returns:
      the Latin script selector

  - ### chinese

    public static TextScript chinese()
    Selects the Chinese script, covering Simplified and Traditional Chinese.
    Returns:
      the Chinese script selector

  - ### devanagari

    public static TextScript devanagari()
    Selects the Devanagari script used by Hindi, Marathi, Nepali and Sanskrit.
    Returns:
      the Devanagari script selector

  - ### japanese

    public static TextScript japanese()
    Selects the Japanese script, covering kanji, hiragana and katakana.
    Returns:
      the Japanese script selector

  - ### korean

    public static TextScript korean()
    Selects the Korean script, covering hangul and hanja.
    Returns:
      the Korean script selector

  - ### getId

    public String getId()
    Returns:
      the stable identifier passed to the port, never `null`

  - ### toString

    public String toString()
    Description copied from class: `Object`
    Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
    Overrides:
      `toString` in class `Object`