From 2a360828967aa62e3d59aabcdbabc278bc4ce825 Mon Sep 17 00:00:00 2001 From: Christoph Auer Date: Wed, 11 Dec 2024 10:26:28 +0100 Subject: [PATCH] Remove more prints Signed-off-by: Christoph Auer --- .../data_management/matching_post_processor.py | 8 ++++---- .../tableformer/data_management/tf_cell_matcher.py | 2 +- .../tableformer/data_management/tf_predictor.py | 11 ++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docling_ibm_models/tableformer/data_management/matching_post_processor.py b/docling_ibm_models/tableformer/data_management/matching_post_processor.py index 7d94dd9..1e5f233 100644 --- a/docling_ibm_models/tableformer/data_management/matching_post_processor.py +++ b/docling_ibm_models/tableformer/data_management/matching_post_processor.py @@ -96,10 +96,10 @@ def _get_good_bad_cells_in_column(self, table_cells, column, matches): if cell["cell_class"] <= 1: allow_class = False else: - print("***") - print("no cell_class in...") - print(cell) - print("***") + self._log.debug("***") + self._log.debug("no cell_class in...") + self._log.debug(cell) + self._log.debug("***") if allow_class: match_list = matches[pdf_cell_id] for match in match_list: diff --git a/docling_ibm_models/tableformer/data_management/tf_cell_matcher.py b/docling_ibm_models/tableformer/data_management/tf_cell_matcher.py index 2b7aca2..4782427 100644 --- a/docling_ibm_models/tableformer/data_management/tf_cell_matcher.py +++ b/docling_ibm_models/tableformer/data_management/tf_cell_matcher.py @@ -264,7 +264,7 @@ def _build_table_cells(self, html_seq, otsl_seq, bboxes, table_classes): r, o = otsl.html_to_otsl(table_html_structure, None, False, False, True, False) if not r: ermsg = "ERR#: COULD NOT CONVERT TO RS THIS TABLE TO COMPUTE SPANS" - print(ermsg) + self._log.debug(ermsg) else: otsl_spans = o["otsl_spans"] diff --git a/docling_ibm_models/tableformer/data_management/tf_predictor.py b/docling_ibm_models/tableformer/data_management/tf_predictor.py index 53c5f82..49366a6 100644 --- a/docling_ibm_models/tableformer/data_management/tf_predictor.py +++ b/docling_ibm_models/tableformer/data_management/tf_predictor.py @@ -30,6 +30,7 @@ # LOG_LEVEL = logging.DEBUG LOG_LEVEL = logging.WARN +logger = s.get_custom_logger(__name__, LOG_LEVEL) class bcolors: HEADER = "\033[95m" @@ -53,17 +54,17 @@ def otsl_sqr_chk(rs_list, logdebug): totcelnum = rs_list.count("fcel") + rs_list.count("ecel") if logdebug: - print("Total number of cells = {}".format(totcelnum)) + logger.debug("Total number of cells = {}".format(totcelnum)) for ind, ln in enumerate(rs_list_split): ln.append("nl") if logdebug: - print("{}".format(ln)) + logger.debug("{}".format(ln)) if len(ln) != init_tag_len: isSquare = False if isSquare: if logdebug: - print( + logger.debug( "{}*OK* Table is square! *OK*{}".format( bcolors.OKGREEN, bcolors.ENDC ) @@ -71,8 +72,8 @@ def otsl_sqr_chk(rs_list, logdebug): else: if logdebug: err_name = "{}***** ERR ******{}" - print(err_name.format(bcolors.FAIL, bcolors.ENDC)) - print( + logger.debug(err_name.format(bcolors.FAIL, bcolors.ENDC)) + logger.debug( "{}*ERR* Table is not square! *ERR*{}".format( bcolors.FAIL, bcolors.ENDC )