pdftract/crates
jedarden a14787794c feat(pdftract-6bwq4): implement baseline clustering algorithm
Implement cluster_spans_into_lines for Phase 4.2 line formation.
Groups spans into lines by baseline proximity using threshold 0.5 * median_font_size.

- Add HasFontSize trait for types with font_size
- Implement cluster_spans_into_lines function
  - Compute baseline for each span
  - Sort by baseline ASC
  - Sweep and cluster within threshold
  - Emit Line per cluster
  - Sort spans by x0 within each line
- Add finalize_line_cluster helper
- Export new items from layout module

Tests: All 11 acceptance criteria tests pass
- Spans baselines 100, 100.5, 105 with median 12: one line
- Spans baselines 100, 110 with median 12: two lines
- Superscript stays on same line as base text
- Empty input produces empty output
- Threshold is 0.5 * median_font_size (not hardcoded)

Closes: pdftract-6bwq4
2026-05-24 10:39:01 -04:00
..
pdftract-cer-diff docs(pdftract-aawrz): add LICENSE-MIT and LICENSE-APACHE files 2026-05-23 10:36:28 -04:00
pdftract-cli feat(pdftract-1s2uj): add xref test fixture corpus and integration test runner 2026-05-24 08:20:04 -04:00
pdftract-core feat(pdftract-6bwq4): implement baseline clustering algorithm 2026-05-24 10:39:01 -04:00
pdftract-libpdftract feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
pdftract-py feat(pdftract-2nu0s): implement Python SDK contract conformance 2026-05-24 08:55:11 -04:00