
I had tesseract word boxes and needed columns. The write-ups I found use one of two recipes: start a new cell wherever the gap between neighbouring words is big, or stack every row on the x axis and cut at the empty stripes. I ran both on the same three tables. Short version: neither won. They break on different tables, and I'd rather live with the break I can spot faster. Setup: tesseract 5.5.3 with the English pack on an Apple M4 Mac, three tables I generated myself (English and digits only, 63, 63 and 45 cells), and scoring where a cell counts only if its text is exactly right and sits in the right column of the row that reads most like it.
Two recipes and the settings I fixed first
The gap method starts a new cell when the space between two words is wider than 1.0 times the median word height. The projection method overlays all rows on the x axis; a stripe at least 8 px wide where 80% of rows are empty becomes a column border. I picked 1.0, 80% and 8 px before I saw a single result.
One prep step: for the two bordered tables I painted the ruling lines white first. Straight off the bordered score table, tesseract found the text of 1 of 63 cells. After the lines were gone it found 62.
Neither method won across the three tables
| Table | Gap method | Projection valleys |
|---|---|---|
| Bordered scores, lines removed | 84% (53/63) | 95% (60/63) |
| Borderless quote | 100% (63/63) | 100% (63/63) |
| Merged header, lines removed | 91% (41/45) | 31% (14/45) |
The orange bar in the last group is projection at 80%, the only bar under 80% anywhere. The green bar next to it is the same method with the empty-row share dropped to 60%.
Each one broke on a different table
The gap rule failed on the bordered scores. Wang Xiaowen sat closer to the 18-digit ID after it than one word height, so the two became one cell. The header Math Physics English glued into a single cell as well, and that pushed everything after it one column over.
The projection rule failed on the merged header. The title row and the East / North and Units / Sales rows run across several columns, so the valleys were no longer empty in 80% of the rows. I got 5 columns instead of 6, 521 29,860 landed in one cell, and the title was cut in half.
Sweeping the settings afterward showed the cliffs
After seeing the results I swept each setting on the same samples.
| Setting | Bordered | Borderless | Merged header |
|---|---|---|---|
| Gap at 0.6 / 0.8 / 1.0 / 1.5 / 2.0 × word height | 100 / 95 / 84 / 84 / 75 | 100 / 100 / 100 / 11 / 11 | 91 at all five |
| Projection at 90 / 80 / 70 / 60 / 50% rows empty | 100 / 95 / 95 / 95 / 95 | 100 at all five | 31 / 31 / 93 / 93 / 93 |
The gap knob has a cliff on the borderless quote: from 1.5 on, columns like Price and Qty get glued and the score falls to 11%. Gap at 0.6 hits 100% on the first two tables, and I don't trust it, since I found it only by looking.
I pick the failure I can see
I now start with projection. That is my reading of how the two fail, not something I measured. Projection gives one column count for the whole table, so a count that disagrees with the image is an immediate warning. The gap method decides row by row, so glued cells show up only as rows with different cell counts. With several spanning header rows I'd still use gap, which held 91% on that table at every setting I tried.
ImgIng gave me text but not all the columns
For a ready-made baseline I ran the same tables through ImgIng (https://imging.ai/), a browser OCR page that works on a desktop, using its default Professional model. On the clean tables it found the text of every cell, in both the Chinese and English versions, with no wrong characters. Its copied text separates columns with tabs, but only some of them: 4 to 6 cells per row on the 7-column English score table, and 2 to 6 on the English quote. I counted by splitting the text on tabs myself, not in a spreadsheet.
What these numbers cover
Every tesseract number above is for English and digit tables only, because this machine has no Chinese language pack for it. The three tables are clean, drawn by a script, and far tidier than a real scan, and every score is from that one batch. I haven't tried faint ruling lines from a real scan.
Top comments (0)