pub struct ContentAnalysis {
pub page_number: usize,
pub page_type: PageType,
pub text_ratio: f64,
pub image_ratio: f64,
pub blank_space_ratio: f64,
pub text_fragment_count: usize,
pub image_count: usize,
pub character_count: usize,
}Expand description
Detailed analysis results for a PDF page
Fields§
§page_number: usizeThe page number (0-indexed)
page_type: PageTypeThe determined page type based on content analysis
text_ratio: f64Percentage of page area covered by text (0.0 to 1.0)
image_ratio: f64Percentage of page area covered by images (0.0 to 1.0)
blank_space_ratio: f64Percentage of page area that is blank space (0.0 to 1.0)
text_fragment_count: usizeNumber of text fragments found on the page
image_count: usizeNumber of images found on the page
character_count: usizeTotal number of characters in text content
Implementations§
Source§impl ContentAnalysis
impl ContentAnalysis
Sourcepub fn is_scanned(&self) -> bool
pub fn is_scanned(&self) -> bool
Returns true if this page appears to be scanned
§Examples
let analysis = ContentAnalysis {
page_number: 0,
page_type: PageType::Scanned,
text_ratio: 0.05,
image_ratio: 0.90,
blank_space_ratio: 0.05,
text_fragment_count: 2,
image_count: 1,
character_count: 15,
};
assert!(analysis.is_scanned());Sourcepub fn is_text_heavy(&self) -> bool
pub fn is_text_heavy(&self) -> bool
Returns true if this page is primarily text-based
Sourcepub fn is_mixed_content(&self) -> bool
pub fn is_mixed_content(&self) -> bool
Returns true if this page has mixed content
Sourcepub fn dominant_content_ratio(&self) -> f64
pub fn dominant_content_ratio(&self) -> f64
Returns the dominant content type ratio (text or image)
Trait Implementations§
Source§impl Clone for ContentAnalysis
impl Clone for ContentAnalysis
Source§fn clone(&self) -> ContentAnalysis
fn clone(&self) -> ContentAnalysis
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ContentAnalysis
impl RefUnwindSafe for ContentAnalysis
impl Send for ContentAnalysis
impl Sync for ContentAnalysis
impl Unpin for ContentAnalysis
impl UnsafeUnpin for ContentAnalysis
impl UnwindSafe for ContentAnalysis
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