pub enum OcrEngine {
PpOcr,
Tesseract,
}Expand description
Which OCR engine recognizes text (#460): the built-in PP-OCRv3 recognizer
(+ the RapidOCR text detector) — the default and the engine every
conformance baseline is pinned against — or the system tesseract binary
(see [crate::tesseract]), docling’s TesseractCliOcrOptions
counterpart. Both consume the same layout-region crops and produce the
same cells; everything downstream is engine-agnostic.
Variants§
PpOcr
PP-OCRv3 recognition via ONNX Runtime (docling’s rapidocr kind).
Tesseract
The tesseract CLI (docling’s tesseract kind).
Implementations§
Source§impl OcrEngine
impl OcrEngine
Sourcepub const ACCEPTED: &'static str = "ppocr | tesseract"
pub const ACCEPTED: &'static str = "ppocr | tesseract"
The accepted spellings, for error messages and docs.
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse an engine id: ppocr (also pp-ocr, rapidocr, docling’s
kind name) or tesseract (also tesseract_cli, tesserocr),
trimmed and case-insensitive. None for anything else.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
The process-level choice from DOCLING_RS_OCR_ENGINE (empty/unset →
PP-OCR; unknown values warn and use PP-OCR).
Sourcepub fn validate_lang(self, raw: &str) -> Result<(), String>
pub fn validate_lang(self, raw: &str) -> Result<(), String>
Whether raw is an ocr_lang this engine can act on — what the
option surfaces validate up front: the en/ch model switch (or a
BCP-47 tag for either, OcrLang::parse) under PP-OCR; tessdata
stems and BCP-47 tags (crate::tesseract::lang_arg) under
Tesseract. The Err says what is accepted.
Trait Implementations§
impl Copy for OcrEngine
impl Eq for OcrEngine
impl StructuralPartialEq for OcrEngine
Auto Trait Implementations§
impl Freeze for OcrEngine
impl RefUnwindSafe for OcrEngine
impl Send for OcrEngine
impl Sync for OcrEngine
impl Unpin for OcrEngine
impl UnsafeUnpin for OcrEngine
impl UnwindSafe for OcrEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().