docling-project / docling-project/docling

Some OCR engines do not create text elements at line-level granularity

Open
#1,753 1 comment 0 reactions 1 assignee Claimed by @cau-git View on GitHub
enhancement
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
Different OCR backends in docling recognize text elements at different granularities. The expected default is that full textlines are created, but this is not consistently the case.

🟡 **EasyOCR**: Defaults to lines. In practice, lines with larger gaps (width of multiple spaces) are broken up inconsistently into multiple boxes with groups of words.

🟢 **RapidOCR**: Produces clean text lines by default.

🟢 **Tesseract OCR (python API)**: Produces clean text lines by default.

🔴 **Tesseract OCR (CLI)**: Produces word-level text cells by default. An additional property `line_num` is not evaluated, hence no grouping into lines happens. The result ends up in `parsed_page.textline_cells` regardless.

🟢 **macOCR**: Produces text lines mostly, no other choices.

### Steps to reproduce
Run the `tests/data_scanned/ocr_test.png` file through docling with different OCR backends and observe the text cell output on the conversion result `conv_res.pages[0].parsed_page`

### Docling version
Any up to latest

### Python version
Any supported

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.