pub struct OcrPostProcessor {
pub character_corrections: HashMap<char, Vec<char>>,
pub dictionary: Option<HashSet<String>>,
pub pattern_corrections: HashMap<String, String>,
pub correction_threshold: f64,
pub max_edit_distance: usize,
}Expand description
OCR post-processor for automatic text correction
Fields§
§character_corrections: HashMap<char, Vec<char>>Common OCR character confusions
dictionary: Option<HashSet<String>>Dictionary of valid words (optional)
pattern_corrections: HashMap<String, String>Common pattern corrections
correction_threshold: f64Confidence threshold for correction
max_edit_distance: usizeMaximum edit distance for corrections
Implementations§
Source§impl OcrPostProcessor
impl OcrPostProcessor
Sourcepub fn with_dictionary(self, dictionary: HashSet<String>) -> Self
pub fn with_dictionary(self, dictionary: HashSet<String>) -> Self
Add a dictionary for word validation
Sourcepub fn process_fragment(
&self,
fragment: &OcrTextFragment,
) -> Vec<CorrectionCandidate>
pub fn process_fragment( &self, fragment: &OcrTextFragment, ) -> Vec<CorrectionCandidate>
Process a fragment and suggest corrections
Sourcepub fn generate_suggestions(&self, word: &str) -> Vec<CorrectionSuggestion>
pub fn generate_suggestions(&self, word: &str) -> Vec<CorrectionSuggestion>
Generate correction suggestions for a word
Trait Implementations§
Source§impl Clone for OcrPostProcessor
impl Clone for OcrPostProcessor
Source§fn clone(&self) -> OcrPostProcessor
fn clone(&self) -> OcrPostProcessor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OcrPostProcessor
impl Debug for OcrPostProcessor
Auto Trait Implementations§
impl Freeze for OcrPostProcessor
impl RefUnwindSafe for OcrPostProcessor
impl Send for OcrPostProcessor
impl Sync for OcrPostProcessor
impl Unpin for OcrPostProcessor
impl UnwindSafe for OcrPostProcessor
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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
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>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().