Kreuzberg.OcrRotation (kreuzberg v4.4.2)

Copy Markdown View Source

Rotation information for OCR-detected text.

Represents the rotation angle of text as detected by OCR, including the confidence of the angle detection.

Fields

  • :angle_degrees - Rotation angle in degrees (-180 to 180), or nil
  • :confidence - Confidence score for rotation detection (0.0-1.0), or nil

Examples

iex> rotation = %Kreuzberg.OcrRotation{
...>   angle_degrees: 15.5,
...>   confidence: 0.88
...> }
iex> rotation.angle_degrees
15.5

Summary

Functions

Creates an OcrRotation struct from a map.

Converts an OcrRotation struct to a map.

Types

t()

@type t() :: %Kreuzberg.OcrRotation{
  angle_degrees: float() | nil,
  confidence: float() | nil
}

Functions

from_map(data)

@spec from_map(map()) :: t()

Creates an OcrRotation struct from a map.

Parameters

  • data - A map containing rotation fields

Returns

An OcrRotation struct with properly typed fields.

Examples

iex> rotation_map = %{"angle_degrees" => 15.5, "confidence" => 0.88}
iex> rotation = Kreuzberg.OcrRotation.from_map(rotation_map)
iex> rotation.angle_degrees
15.5

to_map(rotation)

@spec to_map(t()) :: map()

Converts an OcrRotation struct to a map.

Parameters

  • rotation - An OcrRotation struct

Returns

A map with string keys representing all fields.

Examples

iex> rotation = %Kreuzberg.OcrRotation{
...>   angle_degrees: 15.5,
...>   confidence: 0.88
...> }
iex> Kreuzberg.OcrRotation.to_map(rotation)
%{"angle_degrees" => 15.5, "confidence" => 0.88}