Repository: tesseract-ocr/tesseract
File: src/textord/tablerecog.h (C/C++)

Code before:
  ////////
  //////// Functions to query table info.
  ////////

  // Returns true if inserting part into the table does not cause any
  // cell merges.
  bool DoesPartitionFit(const ColPartition &part) const;
  // Checks if a sub-table has multiple data cells filled.
  int CountFilledCells();
  int CountFilledCellsInRow(int row);
  int CountFilledCellsInColumn(int column);
  int CountFilledCells(int row_start, int row_end, int column_start, int column_end);

  // Makes sure that at least one cell in a row has substantial area filled.
  // This can filter out large whitespace caused by growing tables too far
  // and page numbers.
  // (currently bugged for some reason).
  bool VerifyRowFilled(int row);
  // Finds the filled area in a cell.
  double CalculateCellFilledPercentage(int row, int column);

  // Debug display, draws the table in the given color. If the table is not
  // valid, the table and "best" grid lines are still drawn in the given color.
  void Display(ScrollView *window, ScrollView::Color color);
  
  /// calcualte bounding boxes of the rows and return them
  std::vector<TBOX> getRows();
  /// calcualte bounding boxes of the columns and return them
  std::vector<TBOX> getCols();

protected:
  // Clear the structure information.
  void ClearStructure();

  ////////
  //////// Lined tables
  ////////

  // Verifies the lines do not intersect partitions. This happens when
  // the lines are in column boundaries and extend the full page. As a result,
  // the grid lines go through column text. The condition is detectable.
  bool VerifyLinedTableCells();

  ////////
  //////// Tables with whitespace
  ////////

  // This is the function to change if you want to filter resulting tables
  // better. Right now it just checks for a minimum cell count and such.
  // You could add things like maximum number of ColPartitions per cell or
  // similar.

Review comment (suggestion):
```suggestion
  /// Calculate bounding boxes of the rows and return them.
```

Code after:
  ////////
  //////// Functions to query table info.
  ////////

  // Returns true if inserting part into the table does not cause any
  // cell merges.
  bool DoesPartitionFit(const ColPartition &part) const;
  // Checks if a sub-table has multiple data cells filled.
  int CountFilledCells();
  int CountFilledCellsInRow(int row);
  int CountFilledCellsInColumn(int column);
  int CountFilledCells(int row_start, int row_end, int column_start, int column_end);

  // Makes sure that at least one cell in a row has substantial area filled.
  // This can filter out large whitespace caused by growing tables too far
  // and page numbers.
  // (currently bugged for some reason).
  bool VerifyRowFilled(int row);
  // Finds the filled area in a cell.
  double CalculateCellFilledPercentage(int row, int column);

  // Debug display, draws the table in the given color. If the table is not
  // valid, the table and "best" grid lines are still drawn in the given color.
  void Display(ScrollView *window, ScrollView::Color color);
  
  /// Calculate bounding boxes of the rows and return them.
  std::vector<TBOX> getRows();
  /// Calculate bounding boxes of the columns and return them.
  std::vector<TBOX> getCols();

protected:
  // Clear the structure information.
  void ClearStructure();

  ////////
  //////// Lined tables
  ////////

  // Verifies the lines do not intersect partitions. This happens when
  // the lines are in column boundaries and extend the full page. As a result,
  // the grid lines go through column text. The condition is detectable.
  bool VerifyLinedTableCells();

  ////////
  //////// Tables with whitespace
  ////////

  // This is the function to change if you want to filter resulting tables
  // better. Right now it just checks for a minimum cell count and such.
  // You could add things like maximum number of ColPartitions per cell or
  // similar.