[Python] How to merge split text blocks from multi-line cells in OCR table?

Discussão em 'Python' iniciado por Stack, Abril 13, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working on OCR processing for image-based PDF files using the Google Vision API in a Python 3.11.4 environment.

    The documents are structured as tables, and I need to extract the text from each cell accurately. However, I'm running into an issue where a single cell containing multi-line text is getting split into separate text blocks based on the Y coordinate. This causes the order of the content to be misaligned during reconstruction.

    Desired Output:

    Manufactured Dataline_1 Address Dataline_2 Dataline_3


    Current OCR Result:

    Dataline_2 MAnufactured Dataline_1 Address Dataline_3


    How can I effectively reconstruct multi-line text in a single cell when splits it into different blocks? Any example approaches, post-processing strategies, or best practices would be greatly appreciated.

    Thanks Regards

    enter image description here

    Continue reading...

Compartilhe esta Página