Repository navigation
Proposal: structured JSON output for extraction results #4
Closed
muhammadhreden
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
it's good idea, and for the mentioned structure we've already have all these field so making this would be easy task, the code should follow to_html pattern, also should be mirror the changes to the Python API. So the changies should not affect the logic of extraction only the way of presenting the output |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Would you be open to an additive JSON serialization of the extraction result — pages, blocks, the per-page verdict — alongside the existing text/HTML output? Raising this here before writing code, per the guidelines.
Why
Training data for Arabic document models. Layout-aware VLMs and document transformers train on pairs of page image and structured target: text spans, geometry, reading order. Public corpora of that kind are almost entirely English. qalam already solves the hard part for Arabic — logical word order, base letters, intact ligatures — which is exactly what a corpus built on a generic extractor gets wrong. The missing piece is a machine-readable output, so the structure the layout pass already computed doesn't have to be re-parsed out of HTML.
The verdict is a filtering signal. Keep
okpages as supervision, routefailto OCR, use degraded pages with their reasons as a diagnostic set. In JSON that signal travels with the page instead of being recovered out of band.Also useful outside training. RTL tables that Markdown mirrors with no way to fix, chunking for RAG, diffing extraction output across commits.
Proposed shape
{ "source": "file.pdf", "page_count": 12, "pages": [{ "number": 1, "width": 595.0, "height": 842.0, "verdict": "ok", "score": 1.0, "reasons": [], "blocks": [{ "type": "paragraph", "text": "...", "bbox": [x0, y0, x1, y1], "font_size": 12.0, "direction": "rtl" }] }] }All reactions