Skip to main content

segment_transcript

Function segment_transcript 

Source
pub fn segment_transcript(
    text: &str,
    policy: &SegmentationPolicy,
) -> Result<SegmentationOutcome, MemoryError>
Expand description

Segment text under policy — see the module docs for the full pipeline. Pure: no I/O, no clock, no randomness; the same text + policy always produce byte-identical output.

§Errors

MemoryError::ContextOverLimit when text exceeds MAX_TRANSCRIPT_BYTES, when an unsplittable fence exceeds MAX_FRAGMENT_BYTES, or when the segment count after merging still exceeds MAX_FRAGMENTS — all genuine budget/cap breaches. MemoryError::SegmentationError when SegmentFormat::Jsonl is forced but a line does not parse as a {role, content} object — a FORMAT failure, not a budget breach (issue #1516, m2).