Skip to main content

Module attribution

Module attribution 

Source
Expand description

Word→speaker attribution: join raw ASR words to diarization turns.

Pure-Rust and wasm-clean, behind the opt-in attribution feature — no models, no ort, no I/O. Just interval arithmetic on TimeRange/SpeakerId, reusing the same overlap definition as der::compute_der.

The join is an O(W+T) two-pointer sweep over time-sorted words and turns (max-overlap tagging, bit-identical to the historical linear scan). Optional extras: missing-timestamp interpolation, sentence-level speaker smoothing, and a configurable word anchor for turn-text placement.

Structs§

AttributionConfig
Configuration for the word→speaker join.
SpeakerEmbedding
L2-normalized mean embedding for one speaker (opt-in attribution export).
WhoSaidWhat
Result of the who-said-what cascade: ASR words tagged with speakers, plus the diarization turns with SpeakerTurn::text filled from those words.

Enums§

WordAnchor
Which point on a word interval is used for turn-text placement.

Functions§

attribute_and_fill
Join raw ASR words to diarization turns: attribute each word to a speaker (overlap-region words go to the dominant speaker only — see attribute_words), then fill each turn’s text. Pure — no ASR, no I/O.
attribute_and_fill_with_config
Like attribute_and_fill with an explicit AttributionConfig.
attribute_words
Attribute each ASR word to a diarization speaker turn, returning a WordAlignment per input word in the same order and length.
attribute_words_with_config
Like attribute_words, but with explicit AttributionConfig.
fill_turn_text
Assemble SpeakerTurn::text for each turn from aligned words. A word belongs to a turn when it was attributed to that turn’s speaker and its midpoint falls within the turn’s span; words are joined in time order. Turns with no words keep text: None.
fill_turn_text_with_config
Like fill_turn_text, but the word point tested for turn membership is selected by config.word_anchor.
interpolate_word_timestamps
Fill missing/zero-duration word timestamps with nearest-neighbor values.
speaker_embeddings_from_segments
Average and L2-normalize embeddings per speaker label.
who_said_what
Cascaded who-said-what: run one ASR pass over the whole audio, then join its word timestamps to the already-computed diarization turns.
who_said_what_with_config
Like who_said_what with an explicit AttributionConfig.