pub struct DiarizationResult {
pub segments: Vec<Segment>,
pub turns: Vec<SpeakerTurn>,
pub num_speakers: usize,
pub schema_version: String,
pub audio: AudioMeta,
pub provenance: Provenance,
pub speakers: Vec<SpeakerSummary>,
pub exclusive_turns: Vec<SpeakerTurn>,
}Expand description
Result of offline diarization — the canonical v1 result type that every surface (RTTM/JSON/SRT/VTT/TXT, CLI, MCP) projects from.
The metadata fields (schema_version, audio, provenance, speakers,
exclusive_turns) are additive and #[serde(default)], so older JSON
without them still deserializes. Construct via DiarizationResult::new so
speakers and schema_version are always populated.
Schema family stays diarization-result-v1: new fields are optional and
omitted when empty, so consumers that ignore unknown keys remain compatible.
Fields§
§segments: Vec<Segment>§turns: Vec<SpeakerTurn>§num_speakers: usize§schema_version: StringSchema identifier for downstream consumers.
audio: AudioMetaAudio metadata (duration, sample rate).
provenance: ProvenanceHow this result was produced.
speakers: Vec<SpeakerSummary>Per-speaker rollup (sorted by id); exposes id AND the SPEAKER_NN label.
exclusive_turns: Vec<SpeakerTurn>Single-speaker (exclusive) timeline derived from Self::turns.
At most one speaker is active at every frame — the ASR-reconciliation
surface (overlap is collapsed by a deterministic per-frame argmax). Empty
unless filled via DiarizationResult::with_exclusive. The overlap-aware
Self::turns field is always the primary diarization output.
Implementations§
Source§impl DiarizationResult
impl DiarizationResult
Sourcepub fn new(
segments: Vec<Segment>,
turns: Vec<SpeakerTurn>,
num_speakers: usize,
) -> Self
pub fn new( segments: Vec<Segment>, turns: Vec<SpeakerTurn>, num_speakers: usize, ) -> Self
Build a v1 result from the core fields, computing the per-speaker
speakers rollup from turns and stamping schema_version +
provenance.version. Refine audio/provenance with
DiarizationResult::with_audio / DiarizationResult::with_provenance.
Sourcepub fn with_audio(self, duration_secs: f64, sample_rate: u32) -> Self
pub fn with_audio(self, duration_secs: f64, sample_rate: u32) -> Self
Attach audio metadata (builder).
Sourcepub fn with_provenance(self, provenance: Provenance) -> Self
pub fn with_provenance(self, provenance: Provenance) -> Self
Attach producer provenance (builder). Keeps the existing version when the
supplied provenance.version is empty.
Sourcepub fn with_exclusive(self) -> Self
pub fn with_exclusive(self) -> Self
Fill Self::exclusive_turns from the overlap-aware Self::turns.
Does not modify turns / segments. Safe to call multiple times.
Sourcepub fn with_speaker_embeddings(
self,
embeddings: &[(SpeakerId, Vec<f32>)],
) -> Self
pub fn with_speaker_embeddings( self, embeddings: &[(SpeakerId, Vec<f32>)], ) -> Self
Attach L2-normalized per-speaker embeddings onto Self::speakers.
Speakers with no matching entry keep embedding: None. Vectors are
cloned and re-normalized so callers need not pre-normalize.
Trait Implementations§
Source§impl Clone for DiarizationResult
impl Clone for DiarizationResult
Source§fn clone(&self) -> DiarizationResult
fn clone(&self) -> DiarizationResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiarizationResult
impl Debug for DiarizationResult
Source§impl<'de> Deserialize<'de> for DiarizationResult
impl<'de> Deserialize<'de> for DiarizationResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DiarizationResult
impl PartialEq for DiarizationResult
Source§impl Serialize for DiarizationResult
impl Serialize for DiarizationResult
impl StructuralPartialEq for DiarizationResult
Auto Trait Implementations§
impl Freeze for DiarizationResult
impl RefUnwindSafe for DiarizationResult
impl Send for DiarizationResult
impl Sync for DiarizationResult
impl Unpin for DiarizationResult
impl UnsafeUnpin for DiarizationResult
impl UnwindSafe for DiarizationResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more