msbayindir

Document processing · Model evaluation

How I preserve table structure in Turkish document OCR

Reading every number in a table is only part of the job. A value in the wrong row or column can change the meaning even when the text looks right. I built TR-OCR-Markdown to recover those relationships alongside the characters in a Turkish document image.

Start with the output format

The model takes one page image. It represents headings with Markdown levels, lists with list markers, and tables with a layout that can be parsed into rows and columns. Defining that format first lets the training targets and downstream checks agree on what valid output looks like.

Keeping column labels with their cells makes it possible to reconstruct the table. A search pipeline can also keep the table and its surrounding heading together when indexing the page.

A fictional inventory table illustrating the output format
# Stok sayımı

| Ürün | Adet |
| --- | ---: |
| Defter | 24 |
| Kalem | 36 |

Train across different Turkish document types

I trained a LoRA adapter for DeepSeek-OCR-2. Synthetic Turkish examples covered different document layouts. In v0.4, I added examples from born-digital PDFs, scans of academic and official documents, and receipts and invoices. The mix reduces reliance on a single clean layout.

Measure text and table errors separately

Character error rate (CER) measures transcription, while checking table structure means inspecting which cell belongs to which row and column. The CER figures below come from the model card’s fixed test sets, which were held out of training.

Character error rate (CER). Lower is better.
Fixed test setv0.3v0.4
Born-digital legislation (55 pages)4.7%0.4%
Scanned Official Gazette (50 pages)45.7%25.4%
OCRTurk (165 pages)38.3%16.9%

Interpret the results by document type

Errors are low on born-digital legislation and higher on historical scans and dense numeric tables. Merged cells and handwriting are outside the scope of this release. Some test references were labeled with model assistance, which matters when interpreting the absolute scores. For a table with important values, I check that those values still match their cells in the source image.

Sources

Related projectTR-OCR-Markdown