Skip to content

Drop rotated/vertical text runs from PDF extraction#55

Merged
hallelx2 merged 1 commit into
mainfrom
fix/drop-rotated-margin-text
Jul 4, 2026
Merged

Drop rotated/vertical text runs from PDF extraction#55
hallelx2 merged 1 commit into
mainfrom
fix/drop-rotated-margin-text

Conversation

@hallelx2

@hallelx2 hallelx2 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

@

What

extractPDFRows now skips word runs that pdftable classifies as rotated/vertical (not Upright, or Direction ttb/btt) via a new isRotatedRun helper. Upright LTR and RTL prose is untouched.

Why

Academic PDFs with a rotated left-margin stamp — arXiv arXiv:1706.03762v7 [cs.CL] 2 Aug 2023 — had that vertical text read in reverse, surviving as junk headings/titles:

  • document title → 3202 guA (reversed “Aug 2023”)
  • sections → ]LC.sc[ (“[cs.CL]”), 7v26730.6071:viXra

These are page furniture (margin stamps, watermarks, rotated labels), never body prose. This is the root-cause fix for the weakness the ingest title override (PR #54) only masked.

Verified

Parsing the real arXiv Attention Is All You Need PDF after the fix:

  • title = “Attention Is All You Need” (was 3202 guA)
  • 0 reversed-stamp sections
  • clean outline: Abstract / 1 Introduction / 2 Background / 3 Model Architecture

Tests

  • TestIsRotatedRun covers upright LTR/RTL kept, non-upright + vertical dropped (case-insensitive).
  • go build ./... + go test ./... green.
    @

@
Drop rotated/vertical text runs from PDF extraction

Academic PDFs with a rotated left-margin stamp (arXiv:
"arXiv:1706.03762v7 [cs.CL] 2 Aug 2023") had that vertical text read in
reverse and it survived as junk headings/titles — the document title
became "3202 guA" (reversed "Aug 2023") and sections like "]LC.sc["
(reversed "[cs.CL]") and "7v26730.6071:viXra".

pdftable already classifies each word run: extractPDFRows now skips runs
that are not Upright or whose reading Direction is vertical ("ttb"/"btt")
via isRotatedRun. This removes margin stamps, page-edge watermarks, and
rotated figure labels — page furniture, never body prose — while keeping
upright LTR and RTL text untouched.

Verified on the arXiv "Attention Is All You Need" PDF: title now
"Attention Is All You Need", zero reversed-stamp sections, clean outline
(Abstract / 1 Introduction / 2 Background / 3 Model Architecture).
@

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @hallelx2, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hallelx2, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7492df8d-4a97-467a-9fee-e4376d8e6c96

📥 Commits

Reviewing files that changed from the base of the PR and between 7fb8432 and 90b80b4.

📒 Files selected for processing (2)
  • pkg/parser/pdf.go
  • pkg/parser/rotated_text_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drop-rotated-margin-text

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hallelx2 hallelx2 merged commit d148f4c into main Jul 4, 2026
8 checks passed
@hallelx2 hallelx2 deleted the fix/drop-rotated-margin-text branch July 4, 2026 02:07
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.

1 participant