docling-project / docling-project/docling

Run formula enrichment over table cells (populate rich-cell refs for PDF tables)

Open
#3,828 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Requested feature

Run formula enrichment over table cells during PDF conversion, emitting rich table cells whose `ref` points to a `FormulaItem` — the same structure DOCX/MathML sources already produce.

**User need.** In many technical-document corpora, normative math lives *inside tables* (3GPP channel models, O-RAN performance specs). Today:

- `CodeFormulaModel.is_processable` matches only `CodeItem` or `TextItem` with `label == FORMULA`; enrichment iterates top-level items and never descends into `TableItem.data.table_cells`.
- The PDF/TableFormer backend emits plain-text `TableCell`s, so an equation inside a PDF table cell is serialized as jumbled visual-order glyph text and is unrecoverable downstream. Example: 3GPP TR 38.901's path-loss model equations (Table 7.4.1-1) come out as `…20log h d h d h f d PL c + - + = π…`.

The rich-cell machinery on the docling-core side already exists — `export_to_dataframe` handles ref-bearing cells — so this looks like a pipeline/enrichment gap (detect formula regions inside table-cell bounding boxes and run the code/formula model over them), not a schema gap.

Downstream consumers that convert tables into knowledge-graph structures currently lose exactly the cells that carry the document's core content. We resolve rich-cell refs for DOCX/MathML sources today and would consume this immediately for PDFs. Happy to provide the TR 38.901 reproduction or test against a branch.

### Alternatives

- **Prefer DOCX editions** of specs where they exist (what we do now) — not available for every document, and PDF remains the dominant archival format.
- **Client-side recovery from cell text** — not viable: the visual-order glyph text emitted for PDF cells cannot be reconstructed into LaTeX after the fact.
- **OCR/math-model post-pass outside docling** — would re-parse pages docling already laid out, duplicating work and losing the clean cell↔formula anchoring the rich-cell `ref` gives.

Contributor guide

Open the contributing guide

Research direction

Trace CodeFormulaModel.is_processable and the enrichment iteration, then inspect TableItem.data.table_cells and the PDF/TableFormer backend. Compare the rich-cell structure already produced for DOCX/MathML sources and the docling-core export_to_dataframe handling. Done means PDF table cells containing equations emit refs to FormulaItem objects without breaking ordinary table-cell output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.