# Class TextRecognitionResult

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

public final class TextRecognitionResult extends Object
OCR output containing the complete recognized text and portable block-level geometry. Block bounds use normalized top-left-origin coordinates; a language tag may be absent when the backend does not expose per-block language identification.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `TextRecognitionResult.TextBlock`
  One recognized text block with confidence and normalized bounds.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final TextRecognitionResult`
  `EMPTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TextRecognitionResult(String text, TextRecognitionResult.TextBlock[] blocks)`
  Creates an OCR result without backend metadata.
  `TextRecognitionResult(String text, TextRecognitionResult.TextBlock[] blocks, VisionMetadata metadata)`
  Creates an OCR result with backend diagnostics.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TextRecognitionResult.TextBlock[]`
  `getBlocks()`
  `VisionMetadata`
  `getMetadata()`
  `String`
  `getText()`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### EMPTY

    public static final TextRecognitionResult EMPTY

- ## Constructor Details

  - ### TextRecognitionResult

    public TextRecognitionResult(String text, TextRecognitionResult.TextBlock[] blocks)
    Creates an OCR result without backend metadata.
    Parameters:
      `text` - full recognized text in reading order
      `blocks` - structured text regions, defensively copied

  - ### TextRecognitionResult

    public TextRecognitionResult(String text, TextRecognitionResult.TextBlock[] blocks, VisionMetadata metadata)
    Creates an OCR result with backend diagnostics.
    Parameters:
      `text` - full recognized text in reading order
      `blocks` - structured text regions, defensively copied
      `metadata` - backend details, or `null`

- ## Method Details

  - ### getText

    public String getText()
    Returns:
      complete recognized text in reading order

  - ### getBlocks

    public TextRecognitionResult.TextBlock[] getBlocks()
    Returns:
      defensive copy of recognized blocks

  - ### getMetadata

    public VisionMetadata getMetadata()
    Returns:
      backend metadata, or `null` when manually constructed