From d46186781285172947c80ddd2f5268753ef3764d Mon Sep 17 00:00:00 2001 From: Sadra Barikbin Date: Fri, 26 Apr 2024 09:23:31 +0330 Subject: [PATCH] Refactor function Textord::clean_noise_from_row (#4225) Co-authored-by: Stefan Weil --- src/textord/tordmain.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/textord/tordmain.cpp b/src/textord/tordmain.cpp index a7f2a168f3..b704c89279 100644 --- a/src/textord/tordmain.cpp +++ b/src/textord/tordmain.cpp @@ -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(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; } /**********************************************************************