ontocast.tool.chunk.segment¶
Mutable text segments during chunk preparation (before sizing).
PrepareSegment
dataclass
¶
One logical segment prior to min/max sizing.
section_label_source records how the label was decided. It is load
bearing, not bookkeeping: forward-fill refuses to overwrite a segment whose
section is explicitly unresolved, which is what stops a neighbouring label
from being smeared across an unrecognised section.
Source code in ontocast/tool/chunk/segment.py
coalesce_small_segments_right(segments, min_chars, schema)
¶
Merge undersized segments into the right neighbor; otherwise into the left.
Source code in ontocast/tool/chunk/segment.py
is_abstract_exempt(segment, schema)
¶
Preserve short abstract segments instead of merging them into neighbors.
Source code in ontocast/tool/chunk/segment.py
segments_differ_in_structure(left, right, schema)
¶
True when merging would join distinct document sections.
Source code in ontocast/tool/chunk/segment.py
starts_with_section_heading(segment, schema)
¶
True when the segment opens with a recognised section heading line.