Skip to content

Speaker Models

aana.core.models.speaker

SpeakerDiarizationSegments

SpeakerDiarizationSegments = list[SpeakerDiarizationSegment]

List of SpeakerDiarizationSegment objects.

PyannoteSpeakerDiarizationParams

Bases: BaseModel

A model for the pyannote Speaker Diarization model parameters.

ATTRIBUTE DESCRIPTION
min_speakers

The minimum number of speakers present in the audio.

TYPE: int | None

max_speakers

The maximum number of speakers present in the audio.

TYPE: int | None

SpeakerDiarizationSegment

Bases: BaseModel

Pydantic schema for Segment from Speaker Diarization model.

ATTRIBUTE DESCRIPTION
time_interval

The start and end time of the segment

TYPE: TimeInterval

speaker

speaker assignment of the model in the format "SPEAKER_XX"

TYPE: str

to_dict

to_dict()

Generate dictionary with start, end and speaker keys from SpeakerDiarizationSegment.

RETURNS DESCRIPTION
dict

Dictionary with start, end and speaker keys

TYPE: dict

Source code in aana/core/models/speaker.py
def to_dict(self) -> dict:
    """Generate dictionary with start, end and speaker keys from SpeakerDiarizationSegment.

    Returns:
        dict: Dictionary with start, end and speaker keys
    """
    return {
        "start": self.time_interval.start,
        "end": self.time_interval.end,
        "speaker": self.speaker,
    }