Skip to content

A fast, helpful, and open-source document parser

simplify comments

Logan Markewich480878d2e5eb
diff --git a/crates/liteparse/src/markdown_layout/tables.rs b/crates/liteparse/src/markdown_layout/tables.rs
index 465d81d..b0ca3b2 100644
--- a/crates/liteparse/src/markdown_layout/tables.rs
+++ b/crates/liteparse/src/markdown_layout/tables.rs
@@ -1137,9 +1137,9 @@ pub(super) fn detect_tables(lines: &[ProjectedLine]) -> Vec<TableRun> {
/// Count borderless table runs for the layout-complexity stats. Excludes
/// description lists — a label/value pair block reads fine as text, so it
-/// should not flag the page as table-bearing. `GridFallback` runs DO count:
-/// tabular structure the emitter couldn't extract cleanly is the strongest
-/// possible "route this page to a better parser" signal.
+/// should not flag the page as table-bearing. `GridFallback` runs count:
+/// tabular structure the emitter couldn't extract cleanly still marks the
+/// page as table-bearing.
pub(crate) fn count_text_table_runs(lines: &[ProjectedLine]) -> usize {
detect_tables_impl(lines, false).len()
}
diff --git a/crates/liteparse/src/ocr_merge.rs b/crates/liteparse/src/ocr_merge.rs
index 211baed..c994937 100644
--- a/crates/liteparse/src/ocr_merge.rs
+++ b/crates/liteparse/src/ocr_merge.rs
@@ -29,12 +29,11 @@ const MIN_COLUMN_ITEMS: usize = 8;
/// ...and at least this fraction of the page's text items. Together with
/// `MIN_COLUMN_ITEMS` this keeps thin sidebars, figure captions, and margin
-/// notes from flagging a page as multi-column. First-pass guess pending
-/// calibration against ParseBench's multi_column category.
+/// notes from flagging a page as multi-column.
const MIN_COLUMN_ITEM_FRACTION: f32 = 0.15;
/// Figure coverage at or above this fraction of the page area flags
-/// `DenseGraphics`. First-pass guess, same calibration caveat as above.
+/// `DenseGraphics`.
const DENSE_GRAPHICS_MIN_COVERAGE: f32 = 0.2;
/// Owned page bitmap prepared for OCR. Indices refer to positions in the `pages` slice.
@@ -296,17 +295,15 @@ pub struct LayoutComplexityStats {
pub column_count: usize,
/// Validated ruled-table runs on the page: grid components confirmed
/// against the projected text, so a boxed callout or a chart's axis
- /// gridlines don't count (raw grid detection fired on 94% of ParseBench's
- /// chart docs; validation is what makes this a *table* signal).
+ /// gridlines — lines without cell structure — don't count.
pub ruled_table_count: usize,
/// Combined validated ruled-table area (text extent) over page area,
/// clamped to 1.0.
pub ruled_table_coverage: f32,
/// Borderless table runs found by the emitter's track-alignment detector
- /// over the projected lines (description lists excluded). Ruled tables can
- /// appear here too — their text rows also align to tracks — so do not sum
- /// this with `ruled_table_count`; the two discriminate "ruled" from
- /// "borderless", they don't partition tables.
+ /// over the projected lines (description lists excluded). Ruled tables'
+ /// text rows also align to tracks, so this overlaps `ruled_table_count`
+ /// and must not be summed with it.
pub text_table_run_count: usize,
/// Figure regions clustered from vector graphics.
pub figure_count: usize,
diff --git a/crates/liteparse/src/parser.rs b/crates/liteparse/src/parser.rs
index adc2541..3ce72a1 100644
--- a/crates/liteparse/src/parser.rs
+++ b/crates/liteparse/src/parser.rs
@@ -205,10 +205,8 @@ impl LiteParse {
(pages, page_complexities)
};
- // Layout signals come from the projected page: the XY-cut region tree
- // for columns, figure clusters and ruled-table rects for graphics and
- // tables. Running real projection here (rather than approximating)
- // keeps the signals identical to what a full parse will decide.
+ // Layout signals come from the real projection pass so they match
+ // what a full parse will decide.
let t_layout = web_time::Instant::now();
let parsed_pages = projection::project_pages_to_grid(pages);
for (stats, page) in page_complexities.iter_mut().zip(&parsed_pages) {