Repository navigation
Conversation
|
✅ DCO Check Passed Thanks @wittjeff, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
2db032d to
af3220a
Compare
|
@wittjeff I think this has been fixed by now, no? |
|
@PeterStaar-IBM yes, #361 fixes #355: on 7.22.2 the page-9 heading reads One thing this PR's second test surfaces: the flat 0.35 cap in |
Since 7.22.1 (docling-project#361), contract() caps the unmarked word-gap threshold at a flat 0.35 advance on every line. That fixed the lost word boundaries of docling-project#355, but letter spacing opens every character gap on a line, often past 0.35, so tracked text now splits into letters: "ARTICLE INFO" in elsevier-00.pdf reads "A R T I C L E I N F O", a letter-spaced table cell in 14289803404128846560-14.pdf reads "T i nt a". Both were whole in 7.22.0. The cap now starts at 0.35 and rises with the line's own letter spacing: 1.5 times the median character-cluster gap plus 0.20, measured over gaps between non-dot glyphs so leader dots do not pass for tracking, and only when at least three such gaps exist. Runs without space glyphs apply it to the k-means midpoint as before; runs with space glyphs apply it in place of the flat 0.35, bounded by one advance. On the regression dataset the change only removes boundaries relative to main: 926 lines in 33 files, none of them gluing two dictionary words, and two thirds of them restoring the 7.22.0 line text. No new boundaries appear. Signed-off-by: Jeff Witt <1848307+wittjeff@users.noreply.github.com>
af3220a to
579ef02
Compare
|
Re-scoped and pushed (579ef02). The flat 0.35 cap now rises with the line's own letter spacing: Against main on the regression set, the change only removes boundaries: 926 lines in 33 files (82 pages), none gluing two dictionary words, 665 of them back to their 7.22.0 text. No new boundaries anywhere, and every line from #355 is unchanged. Description and tables updated; the ground truth for those 82 pages would need regenerating. |
…-project#377) The letter-spacing branch shared the half-space gate of the small-gap branch, so tracking at 0.6-0.8 of a space never reached it (found on docling-project#385: Portuguese Calibri text tracked at ~0.7 of a space stayed one word per letter). The small-gap branch keeps its half-space floor; the letter-spacing branch, which carries its own same-font and same-segment evidence, now admits gaps under 0.8 of the run's space. Swept 0.5 to 1.0 on the 940 regression pages: 0.8 makes those words whole with no join beyond what this PR or docling-project#358 already make, apart from one split dot leader joined and a partial join of a letter-split Japanese word; at 1.0 positioned maths symbols join (:,). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Sean Hopkins <sean.p.hopkins@gmail.com>
|
Thanks for this contribution. This PR is on hold until it has been consolidated as described in #428. Please resubmit it as part of the topic PR listed there, with the evidence the issue asks for. |
… spacing Since 7.22.1 (docling-project#361) an unmarked gap above 0.35 neighbouring advances starts a word on every line. Letter spacing opens every gap of a tracked line, often past that, so tracked text that carries space glyphs split into letters: `Tinta` -> `T i nt a` and `Gabinete de Apoio às Freguesias` -> `Ga b i ne t e de Ap o i o à s F r e g ue s i a s` in 14289803404128846560-14.pdf. On a run with space glyphs the threshold is now 1.5 times the median unmarked gap below one advance plus 0.20, at least 0.35 and at most 1.0, when three or more such gaps exist between glyphs that are not leader dots. Runs without space glyphs are not touched: the em rule of the previous commits removes their letter spacing up to 0.2 em, and wider tracking (`a r t i c l e i n f o` in elsevier-00.pdf, 0.44 em) stays a known limit, as docling-project#358 and docling-project#409 both documented. Replaces docling-project#358 (follow-up to docling-project#355). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Jeff Witt <1848307+wittjeff@users.noreply.github.com>
Re-scoped on 2026-10-05: #355 was fixed by #361 (7.22.1). This PR now fixes the regression that #361's flat cap introduced on letter-spaced text.
Problem
Since 7.22.1,
contract()caps the unmarked word-gap threshold at a flat 0.35 advance on every line. Letter spacing opens every character gap on a line, often past 0.35, so tracked text splits into letters. Line cells:elsevier-00.pdfp1ARTICLE INFOA R T I C L E I N F OARTICLE INFO14289803404128846560-14.pdfp14TintaT i nt aTinta14289803404128846560-14.pdfGa b i ne t e de Ap o i o à s F r e g ue s i a sGabinete de Apoio às Freguesias2305.03393v1-pg9.pdf(#355)HyperParameterOptimization(7.21–7.22.0)5.1 Hyper Parameter Optimization5.1 Hyper Parameter OptimizationChange
infer_word_gap()keeps the cap, but lets it rise with the line's own letter spacing:The median is taken over the gaps between non-dot glyphs that fall below the word threshold. Leader dots are spaced like words and would otherwise pass for tracking (
maximum mass of vehicle: . . . .collapsed tomaximummassofvehicle:without that exclusion). The cap only rises when at least three such gaps exist: a single gap, as between a lone math symbol or one table digit and its neighbour, is no evidence of tracking.threshold = min(k-means midpoint, cap). On a line that is not letter-spaced this is exactly main'smin(0.35, midpoint).threshold = min(1.0, cap), in place of the flat 0.35 from fix: updated the page_item_sanitators/cells.h and its associated ground-truth #361.Tests:
tests/test_unit_word_gap_threshold.py: aTc-tracked heading placed withTJoffsets, the same heading with a space glyph, and the LaTeX section heading from Words lose their separating spaces in 7.21.0 ("Related Work" -> "RelatedWork"), bisected to #351 #355. The two tracked cases fail on main.tests/test_regression_cell_contraction.py::test_letter_spaced_text_stays_whole:article infoinelsevier-00.pdfandTintain14289803404128846560-14.pdf.Results
Regression dataset, line cells compared with main (7.22.2), 447 files:
Subst i tut ing→Substituting,heff ingen→heffingen,C H A P T E R 5→CHAPTER 5,F INANCI ALS→FINANCIALS).F t dt→Ftdtin19246029784032167-4.pdf,œ œ œnote heads in4561257296328379730-2.pdf), and a Japanese name list where 7.22.0 also merged (岩 田 守 弘→岩田 守弘).Ground truth. The 82 pages above are the ones whose line cells differ from main, so
test_regression_parse.pyfails on them and the dataset revision would need regenerating. I have not touchedtests/constants.py.Not addressed
a b s t r a c tinelsevier-00.pdfbecomesabs trac t: theTcon that line puts two gaps above the cap. Still closer than main.10458169359009391401-5.pdfstays as on main (the three-gap rule keeps it), although 7.22.0 merged some of its cells.🤖 Generated with Claude Code