WordCorpus
-
class
text_renderer.corpus.
WordCorpus
(cfg: text_renderer.corpus.corpus.CorpusCfg)[source] Output contiguous words of a certain length
-
class
text_renderer.corpus.
WordCorpusCfg
(font_dir: pathlib.Path, font_size: Tuple[int, int], font_list_file: pathlib.Path = None, clip_length: int = -1, char_spacing: Union[float, Tuple[float, float]] = -1, text_color_cfg: text_renderer.config.TextColorCfg = SimpleTextColorCfg(alpha=(110, 255)), horizontal: bool = True, text_paths: List[pathlib.Path] = <factory>, separator: str = ' ', num_word: (<class 'int'>, <class 'int'>) = (1, 5), filter_by_chars: bool = False, chars_file: pathlib.Path = None, filter_font: bool = False, filter_font_min_support_chars: int = 100)[source] Word corpus config
- Parameters
text_paths (List[Path]) – Text file paths
separator (str) – word separator of texts and join char in get_text()
num_word (Tuple[int, int]) – Range of output word count [min_length, max_length)
filter_by_chars (bool) – If True, filtering text by character set
chars_file (Path) – Character set
filter_font (bool) – Only work when filter_by_chars is True. If True filter font file by intersection of font support chars with chars file
filter_font_min_support_chars (int) – If intersection of font support chars with chars file is lower than filter_font_min_support_chars, filter this font file.
Base config for corpus
- Parameters
font_dir (path) – font files directory
font_list_file (path) – font file names to load from font_dir, if not provided, all fonts in font_dir will be used
font_size (tuple[int, int]) – font size in point (min_font_size, max_font_size)
clip_length (int) – clip
get_text()
output. set -1 disables clipchar_spacing ((Union[float, tuple[float, float]])) – Draw character with spacing. If tuple, random choice between [min, max) Set -1 to disable
text_color_cfg (TextColorCfg) – see
TextColorCfg
. has higher priority than RenderCfg.text_color_cfghorizontal (bool) – generate the horizontal(default) or vertical text Set False to generate vertical text