ontocast.tool.chunk.sizing¶
Shared text sizing helpers for OntoCast chunking.
hard_cap_parts(parts, max_size)
¶
Split parts that still exceed max_size at word or character boundaries.
Source code in ontocast/tool/chunk/sizing.py
merge_small_parts(parts, min_size, max_size, *, separator=DEFAULT_PART_SEPARATOR)
¶
Greedy merge of undersized parts without exceeding max_size.
Source code in ontocast/tool/chunk/sizing.py
size_bounded_text(text, config, split_fn, *, separator=DEFAULT_PART_SEPARATOR)
¶
Split text when needed, then enforce OntoCast chunk size bounds.
Source code in ontocast/tool/chunk/sizing.py
size_text_parts(parts, min_size, max_size, *, separator=DEFAULT_PART_SEPARATOR)
¶
Hard-cap oversized parts, then merge to respect min_size / max_size.