Skip to content

Fix chars_in_rect pairing top-down rects with top/bottom - #5096

Open
BetterAndBetterII wants to merge 1 commit into
pymupdf:mainfrom
BetterAndBetterII:cursor/fix-chars-in-rect-coords-1a24
Open

Fix chars_in_rect pairing top-down rects with top/bottom#5096
BetterAndBetterII wants to merge 1 commit into
pymupdf:mainfrom
BetterAndBetterII:cursor/fix-chars-in-rect-coords-1a24

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

Test plan

  • RED then GREEN: synthetic char with top/bottom inside rect and y0/y1 outside is now detected
  • tests/test_tables.pytest_5092 and test_table2 passed

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@BetterAndBetterII

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@JorjMcKie
JorjMcKie requested a review from veget-able August 20, 2026 09:19
@veget-able

Copy link
Copy Markdown
Contributor

Thanks for the fix!

I also tested this against our 503-page table benchmark.
The change looks correct to me. The overall GTRM moved only slightly, from 0.721066 to 0.720618, with just 4 of 503 pages changing.

Looking at those pages individually, one improved significantly, one regression appears to be a ground-truth mismatch, and the remaining two exposed pre-existing edge cases in the refine pipeline that were previously masked because these candidates were being rejected.

So I don't think the small benchmark regression is a reason to hold this fix.

@veget-able

Copy link
Copy Markdown
Contributor

@JorjMcKie
It looks like the CLA check is incomplete because @cursoragent is included as a committer and cannot sign it.

We may run into this more often with agent-assisted PRs, so I think it would be worth deciding how we want to handle agent accounts in the CLA process going forward.

@julian-smith-artifex-com

Copy link
Copy Markdown
Collaborator

There's a cla-assistant issue for this: cla-assistant/cla-assistant#1190, but it only has two comments (including my new one).

Pair top-down rects with character top/bottom, matching has_text().
@BetterAndBetterII
BetterAndBetterII force-pushed the cursor/fix-chars-in-rect-coords-1a24 branch from 71956cc to a0dd7cf Compare August 21, 2026 07:14
github-actions Bot added a commit that referenced this pull request Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Coordinate key mismatch in pymupdf.table.chars_in_rect() drops table candidates and rows

3 participants