A table is a table in every format - #750
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
WaylandYang
force-pushed
the
feat/a-table-is-a-table-in-every-format
branch
from
September 17, 2026 18:03
a033c9f to
5366533
Compare
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pitfall 26 of
docs/design/prior-work.md, the open item left by #744: a table is a structure in every format, not only in HTML.What lands
DOCX, spreadsheet and CSV tables go through the grid that #744 built for HTML. Until now a DOCX table came out as one paragraph per cell, a sheet as tab-joined lines and a CSV as pipe-joined lines with no header separator, so the block parser saw none of them as tables and the model read cells without their headings.
utopia_ingest::table::render_gridtakes rows of (text, span, indent) from any parser and runs the same classification and rendering: caption lines, stacked headers, sections folded into labels, symbols rejoined to figures.parsers::docx_xml_to_text):w:tblrows and cells are collected withw:gridSpanas the span and the first paragraph'sw:indas the indent; a vertically merged continuation cell stays empty; a table nested in a cell is that cell's text. Paragraphs before and after are untouched.# Sheet:heading; empty rows are skipped; a sheet that renders no table falls back to the tab-joined lines.first_is_header): the first row with two or more cells is the header even when its headings are years, and every later row with two cells or a lone figure is a record. A table with no figure anywhere (words only) is read as a header row followed by records, in every format.The text layer of a PDF carries no table structure and is left as it is; a scanned PDF's tables already arrive from MinerU as pipe tables.
A runner to look before extracting:
cargo run -p utopia-ingest --example render_doc -- <file>prints a file as the ingest layer reads it.Checked
Unit tests: a DOCX table with a spanning header and "$" cells renders
| Segment | Revenue |over| Cloud | $1,200 |; a nested table is its cell's text; a CSV whose headings are years keeps them as headings; a CSV of words is still a table. On three real files (a course-exemption roster.xlsx, a visa application form.docx, a simulation-export.csv): the sheet's title row becomes the caption and its header row the header, with the sequence-number rows as records; the CSV's comment lines become the caption and its 639 records a table; the form's tables render as tables, with the label-value interleaving of a form left as it is.Not in this change
Extraction measurements on DOCX or spreadsheet corpora (none is in the benches yet; the NVDA cross-domain recut and the period-column check remain the open items of pitfall 26); PDF text-layer tables.
🤖 Generated with Claude Code