Skip to main content

Module table_ocr_split

Module table_ocr_split 

Source
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:

  1. Detect OCR boxes that overlap with multiple cells (using IoA)
  2. Determine split boundaries based on cell edges
  3. Split the bounding box and distribute text proportionally

§Reference

This implementation is inspired by PaddleX’s split_ocr_bboxes_by_table_cells().

Structs§

CrossCellDetection
Detection result for a cross-cell OCR box.
SplitConfig
Configuration for OCR box splitting.
SplitOcrResult
Result of splitting a single OCR box.
SplitSegment
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.