Part of #66. Foundation for the labeling UI, the future LLM prompt builder, and the eval scorer, all of which must share identical semantics.
Scope
A module of pure functions (no I/O) over utterance sequences:
- Sentence segmentation: split utterance text into sentences. Utterance texts are complete punctuated sentences (see
docs/transcript-segmentation.md), so this is boundary detection on terminal punctuation, with care for quotes/ellipses. Sentence indices become the addressing scheme for sub-utterance labels, so this function defines their meaning.
- Gap ticks: for consecutive same-channel utterances, flag junctions where the silence (
next.start - prev.end) exceeds a threshold (2s to start). ~19% of intra-run junctions exceed 2s; these are candidate turn boundaries.
- Backchannel bridges: flag short
microphone utterances that overlap (or nearly abut) surrounding system speech. These are listener acknowledgments, not turns; consumers should not treat them as run boundaries. ~9% of mic utterances overlap system speech.
- Run grouping: group consecutive system utterances into gap-bounded sub-runs, flowing across bridges.
Requirements
- Expose a
SEGMENTATION_VERSION constant; bump on any change to these algorithms. Exports and stored labels reference it (see storage issue).
- Thresholds as named constants, not magic numbers.
- Unit tests, including a synthetic fixture covering: fused two-speaker utterance, multi-sentence monologue, backchannel with negative gap (overlap), pause with no speaker change, speaker change with no pause.
Reference
The JS in docs/prototypes/labeling-ui.html (sentences(), TICK, BRIDGE, queueItems()) is the reference implementation to port; its synthetic transcript is a starting point for the test fixture. After this module ships, that JS gets deleted from the template in favor of payload fields.
Part of #66. Foundation for the labeling UI, the future LLM prompt builder, and the eval scorer, all of which must share identical semantics.
Scope
A module of pure functions (no I/O) over utterance sequences:
docs/transcript-segmentation.md), so this is boundary detection on terminal punctuation, with care for quotes/ellipses. Sentence indices become the addressing scheme for sub-utterance labels, so this function defines their meaning.next.start - prev.end) exceeds a threshold (2s to start). ~19% of intra-run junctions exceed 2s; these are candidate turn boundaries.microphoneutterances that overlap (or nearly abut) surroundingsystemspeech. These are listener acknowledgments, not turns; consumers should not treat them as run boundaries. ~9% of mic utterances overlap system speech.Requirements
SEGMENTATION_VERSIONconstant; bump on any change to these algorithms. Exports and stored labels reference it (see storage issue).Reference
The JS in
docs/prototypes/labeling-ui.html(sentences(),TICK,BRIDGE,queueItems()) is the reference implementation to port; its synthetic transcript is a starting point for the test fixture. After this module ships, that JS gets deleted from the template in favor of payload fields.