Expand description
Table OCR box splitting utilities.
This module provides functionality to split OCR boxes that span multiple table cells, which improves table recognition accuracy for complex tables with rowspan/colspan.
§Problem
When processing complex tables, OCR text boxes sometimes span multiple cells. Without splitting, the entire text is assigned to a single cell, causing incorrect table structure.
§Solution
This module detects cross-cell OCR boxes and splits them at cell boundaries:
- Detect OCR boxes that overlap with multiple cells (using IoA)
- Determine split boundaries based on cell edges
- Split the bounding box and distribute text proportionally
§Reference
This implementation is inspired by PaddleX’s split_ocr_bboxes_by_table_cells().
Structs§
- Cross
Cell Detection - Detection result for a cross-cell OCR box.
- Split
Config - Configuration for OCR box splitting.
- Split
OcrResult - Result of splitting a single OCR box.
- Split
Segment - A segment resulting from splitting an OCR box.
Functions§
- create_
expanded_ ocr_ for_ table - Creates expanded OCR results after splitting cross-cell boxes.
- detect_
cross_ cell_ ocr_ boxes - Detects OCR boxes that span multiple table cells.
- split_
ocr_ box_ at_ cell_ boundaries - Splits an OCR box at cell boundaries and distributes text proportionally.
- split_
text_ by_ ratio - Splits text into parts based on given ratios.