Confidence scores for OCR text detection and recognition.
Contains separate confidence metrics for different stages of the OCR process: detection (finding text regions) and recognition (reading the text).
Fields
:detection- Confidence score for text detection (0.0-1.0), or nil:recognition- Confidence score for text recognition (0.0-1.0), or nil
Examples
iex> confidence = %Kreuzberg.OcrConfidence{
...> detection: 0.95,
...> recognition: 0.92
...> }
iex> confidence.detection
0.95
Summary
Types
Functions
Creates an OcrConfidence struct from a map.
Parameters
data- A map containing confidence fields
Returns
An OcrConfidence struct with properly typed fields.
Examples
iex> confidence_map = %{"detection" => 0.95, "recognition" => 0.92}
iex> confidence = Kreuzberg.OcrConfidence.from_map(confidence_map)
iex> confidence.detection
0.95
Converts an OcrConfidence struct to a map.
Parameters
confidence- AnOcrConfidencestruct
Returns
A map with string keys representing all fields.
Examples
iex> confidence = %Kreuzberg.OcrConfidence{
...> detection: 0.95,
...> recognition: 0.92
...> }
iex> Kreuzberg.OcrConfidence.to_map(confidence)
%{"detection" => 0.95, "recognition" => 0.92}