Skip to content

fix: preserve multiline DeepSeek and Unlimited OCR blocks - #4909

Closed
PierreMesure wants to merge 1 commit into
docling-project:mainfrom
PierreMesure:fix/ocr-multiline-blocks
Closed

PierreMesure wants to merge 1 commit into
docling-project:mainfrom
PierreMesure:fix/ocr-multiline-blocks

Conversation

@PierreMesure

Copy link
Copy Markdown
Contributor

DeepSeek and Unlimited OCR dropped every text or caption line after the first nonempty line. The shared collector now keeps content through the next annotation, including paragraph breaks. It skips lines already owned by a table, so table markup cannot become caption text.

Resolves #4905.

Checklist:

  • Documentation assessed: restores source content; no API change.
  • Examples are included in regression tests.
  • Tests added for both marker formats, multiline captions, table ownership, and following blocks.

Review evidence:

  • The two new cross-parser multiline cases failed before the fix.
  • CI=true .venv/bin/python -m pytest -q tests/test_ocr_multiline_blocks.py tests/test_unlimited_ocr_markdown.py tests/test_deepseekocr_vlm.py: 10 passed, 1 skipped on Python 3.12. The skipped test requires an external Ollama server.
  • UV_NO_SYNC=1 make validate: all applicable hooks passed.
  • Existing DeepSeek reference exports and document comparisons pass unchanged. No reference fixtures were regenerated.
  • Full Linux CI and model inference were not run locally.

Collect text and captions through the next annotation, preserving paragraphs while skipping markup already owned by a table. Fixes docling-project#4905.

Signed-off-by: Pierre Mesure <pierre@mesu.re>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @PierreMesure, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working ocr labels Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 989aef0b6d. The analysis read the diff only. It did not run code from this pull request.

The PR changes _collect_annotation_content in docling/utils/deepseekocr_utils.py. Text and caption blocks from DeepSeek and Unlimited OCR now keep all lines up to the next annotation, and lines already owned by a table are skipped. It adds regression tests for both marker formats.

Topic labels added: bug, ocr.

CI safety: no concern found. A maintainer must still approve CI.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@PierreMesure

Copy link
Copy Markdown
Contributor Author

The AI code review did not produce a verdict for head 989aef0. The review job stopped with Unexpected error: terminated and exit code 1. No review-result artifact was uploaded, so the publishing job could not find ai-review-result. Both jobs show success because these steps allow errors.

This is a bot execution failure, not a clean review. The four focused parser fixes were tested together again after the #4908 review fix: 129 passed, 1 skipped.

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@PierreMesure

Copy link
Copy Markdown
Contributor Author

Closing as superseded by merged PR #4964, which includes the original signed-off commit and the multiline DeepSeek and Unlimited OCR correction. The fix is now on main, and issue #4905 is closed. The remaining inline-math and LightOnOCR work continues in #4908 and #4789.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) bug Something isn't working ocr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeepSeek and Unlimited OCR discard continuation lines in text blocks

1 participant