pub struct ConversionReport {
pub pages: usize,
pub extracted_words: usize,
pub rendered_words: usize,
pub extracted_chars: usize,
pub rendered_chars: usize,
pub headings_found: usize,
pub lists_found: usize,
pub tables_found: usize,
pub citations_found: usize,
pub per_page: Vec<PageRecovery>,
}Expand description
Audits one PDF-to-Markdown conversion: how much of the extracted text survived into the rendered output, plus a tally of the structural blocks found, so every conversion is auditable rather than a silent best-effort guess.
Fields§
§pages: usize§extracted_words: usizesplit_whitespace().count() word totals, kept for diagnostics only.
Do not use these to judge recovery – hyphenation repair, OCR
word-gap merges, and table-cell tokenization all legitimately shift
word counts by several percent with zero content loss, which made
this ratio produce false FAILs on real documents (kopitiam-wwr).
ConversionReport::recovery_ratio is the authoritative signal;
these fields exist so a human auditing a report still has the raw
word counts to look at.
rendered_words: usize§extracted_chars: usizeNon-whitespace character totals underlying the headline
recovery_ratio. extracted_chars counts
every TextSpan on every page (soft line-wrap hyphens excluded, see
is_wrap_hyphen); rendered_chars counts the rendered Markdown
after strip_rendered_markdown_syntax removes syntax the renderer
added (heading hashes, list markers, table pipes/separators,
blockquote markers, code fences, the figure placeholder).
rendered_chars: usize§headings_found: usize§lists_found: usize§tables_found: usize§citations_found: usize§per_page: Vec<PageRecovery>Per-page character recovery, one entry per source page, in page order.
Populated only when the Document carries page provenance
(Document::block_pages); empty otherwise (a hand-built document has no
page to attribute content to, and guessing would be dishonest). See
PageRecovery.
Implementations§
Source§impl ConversionReport
impl ConversionReport
Sourcepub fn recovery_ratio(&self) -> f64
pub fn recovery_ratio(&self) -> f64
The authoritative recovery signal: rendered_chars / extracted_chars,
both counted as non-whitespace characters after normalizing away
renderer-added Markdown syntax and PDF line-wrap hyphenation
artifacts (see extracted_content_chars and
strip_rendered_markdown_syntax in validation::mod).
What this can detect: content that was extracted from the PDF but never made it into the rendered Markdown – a dropped paragraph, a truncated table, a figure caption that got lost. A character deficit of any size shows up directly as a ratio below 1.0, because unlike a word count, non-whitespace character count cannot be inflated or deflated by re-tokenizing the same content differently.
What this cannot detect: content that survived but was corrupted or reordered – garbled characters from a bad font mapping, two paragraphs swapped, a table’s rows shuffled, a heading demoted to body text. All of those preserve the character count while changing or misplacing the content, so this ratio stays at ~100% and reports PASS regardless. This metric answers “did we lose content?”, not “is the rendered document correct?” – correctness still requires the structural tallies below and, ultimately, human review.
Sourcepub fn word_recovery_ratio(&self) -> f64
pub fn word_recovery_ratio(&self) -> f64
Secondary, informational-only word-count ratio. See the field docs
on extracted_words for why this is not
used for PASS/FAIL: it is reported so a human can still see it, not
because it is trustworthy on its own.
Sourcepub fn passes(&self) -> bool
pub fn passes(&self) -> bool
PASS/FAIL against [MIN_RECOVERY_RATIO], using the character-based
recovery_ratio – never the word-count
ratio, which is informational only (see kopitiam-wwr).
Trait Implementations§
Source§impl Clone for ConversionReport
impl Clone for ConversionReport
Source§fn clone(&self) -> ConversionReport
fn clone(&self) -> ConversionReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConversionReport
impl Debug for ConversionReport
Source§impl Default for ConversionReport
impl Default for ConversionReport
Source§fn default() -> ConversionReport
fn default() -> ConversionReport
Source§impl Display for ConversionReport
impl Display for ConversionReport
Source§impl PartialEq for ConversionReport
impl PartialEq for ConversionReport
impl StructuralPartialEq for ConversionReport
Auto Trait Implementations§
impl Freeze for ConversionReport
impl RefUnwindSafe for ConversionReport
impl Send for ConversionReport
impl Sync for ConversionReport
impl Unpin for ConversionReport
impl UnsafeUnpin for ConversionReport
impl UnwindSafe for ConversionReport
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> 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