876   TBOX best_box = guess_box;  
   879   TBOX adjusted = guess_box;  
   884   const int kMidGuessY = (guess_box.
bottom() + guess_box.
top()) / 2;
   889   bool found_good_border = 
false;
   894   int last_bottom = INT32_MAX;
   904   int previous_below = 0;
   905   const int kMaxChances = 10;
   906   int chances = kMaxChances;
   907   while (bottom != last_bottom) {
   913       table->set_bounding_box(adjusted);
   914       if (table->FindWhitespacedStructure() &&
   927           chances = kMaxChances;
   928           double max_row_height = 
kMaxRowSize * table->median_cell_height();
   930                table->space_below() >= previous_below) ||
   931               (table->CountFilledCellsInRow(0) > 1 &&
   932                table->row_height(0) < max_row_height)) {
   934             best_below = table->space_below();
   935             best_cols = std::max(table->column_count(), best_cols);
   936             found_good_border = 
true;
   939         previous_below = table->space_below();
   947     last_bottom = bottom;
   951   if (!found_good_border)
   955   found_good_border = 
false;
   956   int last_top = INT32_MIN;
   959   int previous_above = 0;
   960   chances = kMaxChances;
   963   while (last_top != top) {
   966       table->set_bounding_box(adjusted);
   967       if (table->FindWhitespacedStructure() &&
   969         int last_row = table->row_count() - 1;
   974           chances = kMaxChances;
   975           double max_row_height = 
kMaxRowSize * table->median_cell_height();
   977                table->space_above() >= previous_above) ||
   978               (table->CountFilledCellsInRow(last_row) > 1 &&
   979                table->row_height(last_row) < max_row_height)) {
   981             best_above = table->space_above();
   982             best_cols = std::max(table->column_count(), best_cols);
   983             found_good_border = 
true;
   986         previous_above = table->space_above();
   999   if (!found_good_border)
  1008   table->set_bounding_box(best_box);
  1009   return table->FindWhitespacedStructure();
 
static bool IsWeakTableRow(StructuredTable *table, int row)
const double kRequiredColumns
int NextHorizontalSplit(int left, int right, int y, bool top_to_bottom)
const double kMarginFactor