Current section

Files

Jump to
xberg lib xberg ocr_strategy.ex
Raw

lib/xberg/ocr_strategy.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.OcrStrategy do
@moduledoc """
Which pages of a PDF get OCR'd when neither `force_ocr` nor `force_ocr_pages` applies.
# Examples
```
use xberg::{ExtractionConfig, OcrStrategy};
// OCR pages that look like scans; keep native text everywhere else.
let config = ExtractionConfig {
ocr_strategy: OcrStrategy::ScannedPages { min_confidence: 0.7 },
..Default::default()
};
assert!(matches!(config.ocr_strategy, OcrStrategy::ScannedPages { .. }));
```
"""
@typedoc "Which pages of a PDF get OCR'd when neither `force_ocr` nor `force_ocr_pages` applies."
@type t :: term()
@typedoc "OCR only when the native text layer fails a quality check (default)."
@type auto :: :auto
@typedoc "Additionally OCR every page that looks like a scan."
@type scanned_pages :: %{type: :scanned_pages, min_confidence: float()}
def scanned_pages(min_confidence), do: {:scanned_pages, %{min_confidence: min_confidence}}
end