Current section
Files
Jump to
Current section
Files
lib/xberg/layout_region.ex
# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:b2c29ab80fb9cdb8c5190a7808ad862ad890f416ad887092447b282a5b1b69e0
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Xberg.LayoutRegion do
@moduledoc """
A detected layout region on a page.
When layout detection is enabled, each page may have layout regions
identifying different content types (text, pictures, tables, etc.)
with confidence scores and spatial positions.
"""
@typedoc "A detected layout region on a page."
@type t :: %__MODULE__{
class_name: String.t() | nil,
confidence: float(),
bounding_box: Xberg.BoundingBox.t(),
area_fraction: float()
}
defstruct class_name: nil,
confidence: 0.0,
bounding_box: nil,
area_fraction: 0.0
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end