Tôi đang tìm một công cụ hoặc một ý tưởng được triển khai trong python để chuyển đổi tệp hOCR (được tạo bởi tesseract trong ứng dụng) thành bảng html. Ý tưởng là sử dụng thông tin vị trí văn bản trong tệp hOCR (được cung cấp trong thuộc tính bbox) để tạo bảng dựa trên vị trí được cung cấp. Tôi đang cung cấp một ví dụ giải thích ý tưởng trên:Chuyển đổi bảng hOCR sang HTML
Tôi đã sử dụng số này image từ SlideShare.net làm đầu vào cho ứng dụng sử dụng tesseract và tôi nhận tệp dưới đây là hOCR/xml.
hOCR file:
<div class='ocr_page' id='page_2' title='image "sample_slide.jpg"; bbox 0 0 638 479; ppageno 1'>
<div class='ocr_carea' id='block_1_1' title="bbox 0 0 638 479">
<p class='ocr_par' dir='ltr' id='par_1' title="bbox 31 104 620 439">
<span class='ocr_line' id='line_1' title="bbox 32 104 613 138"><span class='ocrx_word' id='word_1' title="bbox 32 105 119 131">done:</span> <span class='ocrx_word' id='word_2' title="bbox 132 104 262 138">working</span> <span class='ocrx_word' id='word_3' title="bbox 273 105 405 138">product,</span> <span class='ocrx_word' id='word_4' title="bbox 419 104 517 132">hotels</span> <span class='ocrx_word' id='word_5' title="bbox 528 104 613 132">listed</span>
</span>
<span class='ocr_line' id='line_2' title="bbox 31 160 471 194"><span class='ocrx_word' id='word_6' title="bbox 31 164 62 187">to</span> <span class='ocrx_word' id='word_7' title="bbox 75 161 122 187">do:</span> <span class='ocrx_word' id='word_8' title="bbox 134 164 227 187">smart</span> <span class='ocrx_word' id='word_9' title="bbox 236 160 330 187">traffic</span> <span class='ocrx_word' id='word_10' title="bbox 342 160 471 194">building</span>
</span>
<span class='ocr_line' id='line_3' title="bbox 32 243 284 280"><span class='ocrx_word' id='word_11' title="bbox 32 243 128 280">seed</span> <span class='ocrx_word' id='word_12' title="bbox 148 243 284 280">round:</span>
</span>
<span class='ocr_line' id='line_4' title="bbox 71 316 619 361"><span class='ocrx_word' id='word_13' title="bbox 71 321 156 356">CEO</span> <span class='ocrx_word' id='word_14' title="bbox 171 319 240 355">will</span> <span class='ocrx_word' id='word_15' title="bbox 260 321 384 356">invest</span> <span class='ocrx_word' id='word_16' title="bbox 517 316 619 361">$30k</span>
</span>
<span class='ocr_line' id='line_5' title="bbox 75 392 620 439"><span class='ocrx_word' id='word_17' title="bbox 75 397 252 433">investor</span> <span class='ocrx_word' id='word_18' title="bbox 489 392 620 439">$120k</span>
</span>
</p>
</div>
</div>
Những gì tôi cần là để chuyển đổi các tập tin hOCR html bảng dựa trên vị trí của tiếp theo. Bảng dự định sẽ trông giống như this table.
Kích thước và vị trí của ô bảng phản ánh thông tin được cung cấp trong tệp hOCR.
Nguồn hình ảnh: slideshare.net
https://github.com/ultrasaurus/hocr-javascript – RAVI