KolmoPDF 示範如何檢查 PDF 轉 Markdown 時表格標籤是否遺失
A PDF table can lose its dataset labels: a Markdown conversion check
KolmoPDF 提供一套 PDF 轉 Markdown 檢查流程,透過對照原始 PDF 與轉換結果,確認表格標題、數值及其數據集關係有否保留。文中以示例表格説明,若兩欄都只剩「Accuracy」,數值雖然仍在,數據集標籤卻已遺失,檢索系統便無法可靠判斷數值所屬欄位。
A PDF can contain a table that looks obvious on screen and becomes ambiguous in a Markdown file. Consider a results table with two columns named "Accuracy" under different dataset headings. If the parent headings disappear, both values survive, but a retrieval system can no longer tell which dataset each value describes.
A useful first conversion test is to take a small, authorized document with a representative table through KolmoPDF's PDF-to-Markdown page, then compare the output with the source. The goal is to find out whether the extracted structure is usable for the questions your application needs to answer. This walkthrough uses an illustrative table; the examples below are test fixtures, not output from a particular PDF.
Pick a page that can fail in a meaningful way
Choose a page with at least one of these features:
- A table with grouped headers, units, or footnote markers.
- Two text columns with a figure caption between them.
- A formula whose subscripts or superscripts change its meaning.
Record the document name, page number, and what a correct extraction must preserve. For the example below, the expected relationship is that each accuracy value belongs to a specific dataset and model. The source table has this shape:
| Model | Dataset A accuracy | Dataset B accuracy |
|---|---|---|
| Cedar | 91% | 84% |
| Maple | 88% | 90% |
Imagine the PDF uses a two-level header: "Dataset A" and "Dataset B" above separate cells that each read "Accuracy". The names Cedar and Maple and the values are invented for this test. They are deliberately similar enough that a misplaced header changes the answer without producing an obviously invalid number.
Convert and inspect the Markdown
Open the PDF-to-Markdown tool, select an authorized PDF, and run the conversion. Once the Markdown is available, inspect the section containing the chosen page alongside the original PDF. KolmoPDF supports technical PDF conversion with tables, formulas, code blocks, and multi-column layouts; individual results still need checking against the source.
A usable representation of the fixture could look like this:
| Model | Dataset A accuracy | Dataset B accuracy |
| --- | --- | --- |
| Cedar | 91% | 84% |
| Maple | 88% | 90% |
This alternative keeps the values but loses the dataset labels:
| Model | Accuracy | Accuracy |
| --- | --- | --- |
| Cedar | 91% | 84% |
| Maple | 88% | 90% |
A renderer can display both tables. A downstream system receiving the second one cannot reliably answer which Cedar value belongs to Dataset B without recovering the missing context. If a footnote changes the meaning of a value, check that the marker and its note survive too. An intact number alone is not a sufficient pass.
Turn the page into a regression fixture
Keep the original PDF and converted Markdown under the same document version. For documents you have permission to retain, record the page number and the expected facts in a small test file. For example:
{
"document": "example-results-v1.pdf",
"page": 4,
"question": "What is Cedar's accuracy on Dataset B?",
"expected_answer": "84%",
"required_context": ["Cedar", "Dataset B", "accuracy"]
}
The page number here is illustrative. A real fixture should use the actual source page and values. Compare the converted content with the source before using it as a reference: otherwise the test can preserve the same mistake as the conversion.
For retrieval, inspect the exact chunk returned for the question. It should contain the model, the dataset label, and the value together, or carry a reference that lets your application reconstruct that relationship. If a chunk holds only Cedar | 91% | 84%, the answer generator may guess which column is which. Repeat the table header with row groups when splitting a long table, while retaining the original page reference separately.
For formulas, use the same principle: compare the extracted expression with the page and check the symbols that distinguish the quantities. A visually plausible formula with a missing subscript can describe a different variable. For multi-column pages, read across the extracted paragraph boundaries and check that a caption has not interrupted a sentence.
Decide what happens when the check fails
A failed example can go into a review queue with the page reference and the affected passage. Correct the Markdown against the PDF before indexing that passage, or exclude it until someone can verify it. Keep the uncorrected conversion as well as the correction if you need to trace the decision later.
Run the same fixture after changing conversion settings or chunking rules. Check both the extracted relationship and the retrieval result: a correct Markdown table can still lose its header during chunking. For multi-page tables, also inspect whether a continuation retains the right headings and notes. The table audit workflow covers that downstream check in more detail.
KolmoPDF also provides API documentation for workflows that need programmatic access. Start with the web comparison when building the fixture, then apply the same acceptance checks to the integration you choose. Processing is online by default, so use documents you are authorized to upload.
來源:DEV Community · dev.to