Skip to content

Commit

Permalink
Refactor function Textord::clean_noise_from_row (#4225)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
sadra-barikbin and stweil committed Apr 26, 2024
1 parent a1837f1 commit d461867
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/textord/tordmain.cpp
Expand Up @@ -533,16 +533,17 @@ bool Textord::clean_noise_from_row( // remove empties
}
}
}
// TODO: check whether `&& super_norm_count < textord_noise_sncount`should always be added here.
bool rejected = dot_count > norm_count * textord_noise_normratio &&
dot_count > 2;
if (textord_noise_debug) {
tprintf("Row ending at (%d,%g):", blob_box.right(), row->base_line(blob_box.right()));
tprintf(" R=%g, dc=%d, nc=%d, %s\n",
norm_count > 0 ? static_cast<float>(dot_count) / norm_count : 9999, dot_count,
norm_count,
dot_count > norm_count * textord_noise_normratio && dot_count > 2 ? "REJECTED"
: "ACCEPTED");
rejected? "REJECTED": "ACCEPTED");
}
return super_norm_count < textord_noise_sncount &&
dot_count > norm_count * textord_noise_rowratio && dot_count > 2;
return super_norm_count < textord_noise_sncount && rejected;
}

/**********************************************************************
Expand Down

0 comments on commit d461867

Please sign in to comment.