Current section

Files

Jump to
xberg lib xberg ocr_quality_thresholds.ex
Raw

lib/xberg/ocr_quality_thresholds.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:209a244862e56919f9675a72596b4bcd9283654720164e27cad36e49934090ab
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Xberg.OcrQualityThresholds do
@moduledoc """
Quality thresholds for OCR fallback decisions and pipeline quality gating.
All fields default to the values that match the previous hardcoded behavior,
so `OcrQualityThresholds::default()` preserves existing semantics exactly.
"""
@typedoc "Quality thresholds for OCR fallback decisions and pipeline quality gating."
@type t :: %__MODULE__{
min_total_non_whitespace: non_neg_integer(),
min_non_whitespace_per_page: float(),
min_meaningful_word_len: non_neg_integer(),
min_meaningful_words: non_neg_integer(),
min_alnum_ratio: float(),
min_garbage_chars: non_neg_integer(),
max_fragmented_word_ratio: float(),
critical_fragmented_word_ratio: float(),
min_avg_word_length: float(),
min_words_for_avg_length_check: non_neg_integer(),
min_consecutive_repeat_ratio: float(),
min_words_for_repeat_check: non_neg_integer(),
substantive_min_chars: non_neg_integer(),
non_text_min_chars: non_neg_integer(),
alnum_ws_ratio_threshold: float(),
pipeline_min_quality: float(),
min_undecodable_ratio: float(),
enable_provenance_ocr_routing: boolean(),
min_provenance_fallback_ratio: float()
}
defstruct min_total_non_whitespace: 64,
min_non_whitespace_per_page: 32,
min_meaningful_word_len: 4,
min_meaningful_words: 3,
min_alnum_ratio: 0.3,
min_garbage_chars: 5,
max_fragmented_word_ratio: 0.6,
critical_fragmented_word_ratio: 0.8,
min_avg_word_length: 2,
min_words_for_avg_length_check: 50,
min_consecutive_repeat_ratio: 0.08,
min_words_for_repeat_check: 50,
substantive_min_chars: 100,
non_text_min_chars: 20,
alnum_ws_ratio_threshold: 0.4,
pipeline_min_quality: 0.5,
min_undecodable_ratio: 0.0,
enable_provenance_ocr_routing: false,
min_provenance_fallback_ratio: 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