struct

Whisper::Segment

Inherits Struct < Value < Object

A single transcription segment returned by Whisper#transcribe.

Each segment represents a contiguous span of recognized speech with timing information and confidence metadata.

Constructors

new(text : String, start_ms : Int64, end_ms : Int64, no_speech_probability : Float32, speaker_turn_next : Bool, speaker_turn : Int32 = 0, tokens : Array(Whisper::Token) = [] of Token)
Source

Instance methods

duration_ms

Segment duration in milliseconds.

Source
end_ms

Segment end time in milliseconds from the beginning of the audio.

Source
end_seconds

Segment end time in seconds.

Source
end_timestamp

Formatted end time as "HH:MM:SS.mmm".

Source
no_speech_probability

Probability that this segment contains no speech (0.0 to 1.0). Higher values suggest background noise, silence, or music rather than speech.

Source
speaker_turn

Incrementing speaker turn counter. Starts at 0 and increments at each speaker turn boundary (when the previous segment had speaker_turn_next == true).

Source
speaker_turn_next

When true, indicates the next segment is from a different speaker. Useful for diarization or dialog formatting.

Source
start_ms

Segment start time in milliseconds from the beginning of the audio.

Source
start_seconds

Segment start time in seconds.

Source
start_timestamp

Formatted start time as "HH:MM:SS.mmm".

Source
text

The transcribed text for this segment.

Source
tokens

Per-token data for this segment (empty unless token-level data was requested).

Source