public final class TranscriptionSegment

  1. Object
  2. TranscriptionSegment
One timed transcript span. Times are offsets from the start of the transcribed audio in milliseconds.

Constructors

public TranscriptionSegment(long startTimeMs, long endTimeMs, String text)Creates a timed transcript span.

Methods

public long getStartTimeMs()Gets the segment start offset from the beginning of the audio.
public long getEndTimeMs()Gets the segment end offset from the beginning of the audio.
public String getText()Gets the text recognized in this segment.

Inherited methods

Constructor details

TranscriptionSegment

public TranscriptionSegment(long startTimeMs, long endTimeMs, String text)
Creates a timed transcript span.

Parameters

startTimeMs long
start offset from the beginning of the audio, in milliseconds
endTimeMs long
end offset from the beginning of the audio, in milliseconds
text String
text recognized in this span; null is treated as an empty string

Throws

IllegalArgumentException
if either timestamp is negative, or if endTimeMs is before startTimeMs

Method details

getStartTimeMs

public long getStartTimeMs()
Gets the segment start offset from the beginning of the audio.

Returns

start offset in milliseconds

getEndTimeMs

public long getEndTimeMs()
Gets the segment end offset from the beginning of the audio.

Returns

end offset in milliseconds

getText

public String getText()
Gets the text recognized in this segment.

Returns

recognized text, never null