From 232c6bed4b0aa5c3ed870cae9b095b3dc2bbac34 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Tue, 17 Jan 2023 09:54:50 +0100 Subject: [PATCH] Refactoring: Rename --- test/fixtures/page_generation/page.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/fixtures/page_generation/page.py b/test/fixtures/page_generation/page.py index 71bd28a..ba22be2 100644 --- a/test/fixtures/page_generation/page.py +++ b/test/fixtures/page_generation/page.py @@ -16,6 +16,7 @@ from faker import Faker from matplotlib import pyplot as plt from cv_analysis.utils import star, rconj +from cv_analysis.utils.merging import merge_related_rectangles Image_t = Union[Image.Image, np.ndarray] # @@ -463,17 +464,17 @@ class RandomTextBlock(ContentRectangle): # This is meant to be read from the bottom up. current_line_shall_not_be_a_full_line = truncate_current_line() - line_processor = self.truncate_line if current_line_shall_not_be_a_full_line else identity - process_current_line = compose(line_processor, first) + line_formatter = self.truncate_line if current_line_shall_not_be_a_full_line else identity + format_current_line = compose(line_formatter, first) move_current_line_to_back = star(rconj) - split_first_line_from_lines_and_process_the_former = juxt(rest, process_current_line) - split_off_current_line_then_process_it_then_move_it_to_the_back = rcompose( - split_first_line_from_lines_and_process_the_former, + split_first_line_from_lines_and_format_the_former = juxt(rest, format_current_line) + split_off_current_line_then_format_it_then_move_it_to_the_back = rcompose( + split_first_line_from_lines_and_format_the_former, move_current_line_to_back, ) current_line_is_a_full_line = not current_line_shall_not_be_a_full_line # Start reading here and move up. - return current_line_is_a_full_line, split_off_current_line_then_process_it_then_move_it_to_the_back(lines) + return current_line_is_a_full_line, split_off_current_line_then_format_it_then_move_it_to_the_back(lines) def format_line(self, line, full=True): line = self.truncate_line(line) if not full else line @@ -519,7 +520,8 @@ class PagePartitioner: box = Rectangle(left_margin, top_margin, page.width - right_margin, page.height - bottom_margin) boxes = lflatten(self.generate_content_boxes(box)) - boxes = self.drop_small_boxes(boxes, *page.size) + # boxes = self.drop_small_boxes(boxes, *page.size) + # boxes = merge_related_rectangles(boxes) boxes = list(boxes) return boxes