React Native OCR - v0.11.0
    Preparing search index...

    Function greedyCtcDecode

    • Greedily decodes softmaxed CTC probabilities: takes each timestep's most probable class natively (math.argmax + math.gather), drops the blank (index 0) and consecutive repeats, and averages the kept timesteps' probabilities into a confidence.

      This is the default recognizer decode; a custom decode option on an OCR model replaces it and may use it as a building block.

      Parameters

      • probs: Tensor

        Softmaxed recognizer output, float32 of shape [1, T, V] (a plain [T, V] is accepted too). Index 0 of V is the CTC blank.

      • charset: readonly string[]

        The CTC lookup: charset[i] labels class i, with the blank placeholder at index 0. Classes beyond its length count toward the confidence but emit no text.

      Returns { confidence: number; text: string }

      The decoded text and the mean probability of the non-blank timesteps (0 when there are none).

      With code INVALID_ARGUMENT when probs is not a float32 tensor of rank 2 or 3.