pub struct OcrTextFragment {
pub text: String,
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
pub confidence: f64,
pub word_confidences: Option<Vec<WordConfidence>>,
pub font_size: f64,
pub fragment_type: FragmentType,
}Expand description
Text fragment extracted by OCR with position and confidence information
Fields§
§text: StringThe extracted text content
x: f64X position in page coordinates (points)
y: f64Y position in page coordinates (points)
width: f64Width of the text fragment (points)
height: f64Height of the text fragment (points)
confidence: f64Confidence score for this fragment (0.0 to 1.0)
word_confidences: Option<Vec<WordConfidence>>Word-level confidence scores (optional, for advanced OCR engines)
font_size: f64Font size estimation (points)
fragment_type: FragmentTypeWhether this fragment is part of a word or line
Implementations§
Source§impl OcrTextFragment
impl OcrTextFragment
Sourcepub fn new(
text: String,
x: f64,
y: f64,
width: f64,
height: f64,
confidence: f64,
font_size: f64,
fragment_type: FragmentType,
) -> Self
pub fn new( text: String, x: f64, y: f64, width: f64, height: f64, confidence: f64, font_size: f64, fragment_type: FragmentType, ) -> Self
Create a new OCR text fragment
Sourcepub fn with_word_confidences(
text: String,
x: f64,
y: f64,
width: f64,
height: f64,
confidence: f64,
font_size: f64,
fragment_type: FragmentType,
word_confidences: Vec<WordConfidence>,
) -> Self
pub fn with_word_confidences( text: String, x: f64, y: f64, width: f64, height: f64, confidence: f64, font_size: f64, fragment_type: FragmentType, word_confidences: Vec<WordConfidence>, ) -> Self
Create a fragment with word-level confidence scores
Sourcepub fn get_low_confidence_words(&self, threshold: f64) -> Vec<&WordConfidence>
pub fn get_low_confidence_words(&self, threshold: f64) -> Vec<&WordConfidence>
Get words with confidence below the threshold
Sourcepub fn average_word_confidence(&self) -> Option<f64>
pub fn average_word_confidence(&self) -> Option<f64>
Get the average word confidence if available
Sourcepub fn words_by_confidence(&self) -> Vec<&WordConfidence>
pub fn words_by_confidence(&self) -> Vec<&WordConfidence>
Get words sorted by confidence (lowest first)
Sourcepub fn has_low_confidence_words(&self, threshold: f64) -> bool
pub fn has_low_confidence_words(&self, threshold: f64) -> bool
Check if this fragment has any low-confidence words
Sourcepub fn get_correction_candidates(
&self,
threshold: f64,
) -> Vec<CorrectionCandidate>
pub fn get_correction_candidates( &self, threshold: f64, ) -> Vec<CorrectionCandidate>
Get words that are candidates for correction (low confidence + patterns)
Sourcepub fn confidence_report(&self) -> String
pub fn confidence_report(&self) -> String
Generate a confidence report for this fragment
Trait Implementations§
Source§impl Clone for OcrTextFragment
impl Clone for OcrTextFragment
Source§fn clone(&self) -> OcrTextFragment
fn clone(&self) -> OcrTextFragment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OcrTextFragment
impl RefUnwindSafe for OcrTextFragment
impl Send for OcrTextFragment
impl Sync for OcrTextFragment
impl Unpin for OcrTextFragment
impl UnsafeUnpin for OcrTextFragment
impl UnwindSafe for OcrTextFragment
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
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>
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 more