Refactoring: Rename
This commit is contained in:
parent
0f6e87b8a6
commit
0e7791394f
@ -10,7 +10,7 @@ from cv_analysis.utils.geometric import is_square_like
|
||||
from cv_analysis.utils.merging import merge_related_rectangles
|
||||
from cv_analysis.utils.postprocessing import remove_included, remove_overlapping
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
from synthesis.segment.content_rectangle import ContentRectangle
|
||||
from synthesis.segment.recursive_content_rectangle import RecursiveContentRectangle
|
||||
from synthesis.segment.segments import (
|
||||
|
||||
@ -5,7 +5,7 @@ from PIL import Image
|
||||
from funcy import lflatten
|
||||
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
|
||||
|
||||
class PagePartitioner(abc.ABC):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.partitioner.page_partitioner import PagePartitioner
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
|
||||
|
||||
class RandomPagePartitioner(PagePartitioner):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.partitioner.page_partitioner import PagePartitioner
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
|
||||
|
||||
class TwoColumnPagePartitioner(PagePartitioner):
|
||||
|
||||
@ -13,6 +13,9 @@ random_seed = random.randint(0, 2**32 - 1)
|
||||
|
||||
# 2467967671
|
||||
|
||||
# random_seed = 237553299
|
||||
# random_seed = 1021421466
|
||||
|
||||
logger.info(f"Random seed: {random_seed}")
|
||||
rnd = random.Random(random_seed)
|
||||
|
||||
@ -11,7 +11,7 @@ from matplotlib.colors import ListedColormap
|
||||
from cv_analysis.utils.geometric import is_square_like, is_wide, is_tall
|
||||
from cv_analysis.utils.image_operations import superimpose
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.random import rnd, probably, maybe
|
||||
from synthesis.randomization import rnd, probably, maybe
|
||||
from synthesis.segment.random_content_rectangle import RandomContentRectangle
|
||||
from synthesis.text.text import generate_random_words
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import random
|
||||
|
||||
from synthesis.random import get_random_seed
|
||||
from synthesis.randomization import get_random_seed
|
||||
from synthesis.segment.content_rectangle import ContentRectangle
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.random import probably, rnd
|
||||
from synthesis.randomization import probably, rnd
|
||||
from synthesis.segment.content_rectangle import ContentRectangle
|
||||
from synthesis.segment.plot import RandomPlot
|
||||
from synthesis.segment.text_block import TextBlock
|
||||
|
||||
@ -13,7 +13,7 @@ from cv_analysis.utils.geometric import is_square_like
|
||||
from cv_analysis.utils.image_operations import superimpose
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from cv_analysis.utils.spacial import area
|
||||
from synthesis.random import rnd, possibly
|
||||
from synthesis.randomization import rnd, possibly, maybe
|
||||
from synthesis.segment.content_rectangle import ContentRectangle
|
||||
from synthesis.segment.plot import pick_colormap
|
||||
from synthesis.segment.random_content_rectangle import RandomContentRectangle
|
||||
@ -50,7 +50,7 @@ class RecursiveRandomTable(RandomContentRectangle, RecursiveContentRectangle):
|
||||
|
||||
self.content = Image.new("RGBA", (self.width, self.height), (255, 255, 255, 0))
|
||||
|
||||
self.background_color = get_random_background_color()
|
||||
self.background_color = maybe() and get_random_background_color() or (255, 255, 255, 0)
|
||||
|
||||
self.layout = layout or self.pick_random_layout()
|
||||
logger.debug(f"Layout: {self.layout}")
|
||||
|
||||
@ -7,7 +7,7 @@ from PIL import Image, ImageDraw, ImageFont
|
||||
from funcy import lmap, complement, keep, first, lzip, omit, project
|
||||
from loguru import logger
|
||||
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
|
||||
|
||||
class RandomFontPicker:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from funcy import identity, compose, first, juxt, rest, rcompose
|
||||
|
||||
from cv_analysis.utils import star, rconj
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
from synthesis.text.line_formatter.line_formatter import LineFormatter
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import random
|
||||
|
||||
from faker import Faker
|
||||
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
|
||||
|
||||
def generate_random_words(n_min, n_max):
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from funcy import first, rest
|
||||
|
||||
from cv_analysis.utils import conj
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
from synthesis.text.text_block_generator.paragraph import generate_random_text_lines
|
||||
from synthesis.text.text_block_generator.text_block_generator import TextBlockGenerator
|
||||
from synthesis.text.line_formatter.identity import IdentityLineFormatter
|
||||
|
||||
@ -7,7 +7,7 @@ from funcy import iterate, take, last
|
||||
from cv_analysis.logging import debug_log
|
||||
from cv_analysis.utils import star
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
from synthesis.text.line_formatter.identity import IdentityLineFormatter
|
||||
from synthesis.text.line_formatter.line_formatter import LineFormatter
|
||||
from synthesis.text.line_formatter.paragraph import ParagraphLineFormatter
|
||||
|
||||
2
test/fixtures/page_generation/page.py
vendored
2
test/fixtures/page_generation/page.py
vendored
@ -14,7 +14,7 @@ from cv_analysis.utils.image_operations import blur, sharpen, overlay, superimpo
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from synthesis.content_generator import ContentGenerator
|
||||
from synthesis.partitioner.two_column import TwoColumnPagePartitioner
|
||||
from synthesis.random import rnd
|
||||
from synthesis.randomization import rnd
|
||||
from synthesis.segment.table.table import paste_contents
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user