pub struct Session<'a, T, M: Mode, L = ()> { /* private fields */ }Expand description
One transcription run over audio that arrives while the run is live.
Constructed over a recording the caller feeds, or straight from the
microphone where one exists. finish waits for input to end, drains the
tail, and returns the completed transcript.
Implementations§
Source§impl<'a, T: Transcriber, M: Mode, L: Layer> Session<'a, T, M, L>
impl<'a, T: Transcriber, M: Mode, L: Layer> Session<'a, T, M, L>
Sourcepub fn over(
transcription: &'a Transcription<T, M, L>,
language: &'a Language,
recording: RecordingReader,
) -> Result<Self, TranscriptionError>
pub fn over( transcription: &'a Transcription<T, M, L>, language: &'a Language, recording: RecordingReader, ) -> Result<Self, TranscriptionError>
Runs against a recording the caller already has. Whoever feeds it also
ends it; finish only waits for that end and finishes the transcript.
Sourcepub fn finish(self) -> Result<Transcript, TranscriptionError>
pub fn finish(self) -> Result<Transcript, TranscriptionError>
Waits for input to end, drains whatever remains, and returns the
completed transcript — or TranscriptionError::NoSpeech when
nothing was said.
Source§impl<'a, T: Transcriber, M: Mode, L: Layer> Session<'a, T, M, L>
impl<'a, T: Transcriber, M: Mode, L: Layer> Session<'a, T, M, L>
Sourcepub fn microphone(
transcription: &'a Transcription<T, M, L>,
language: &'a Language,
) -> Result<Self, TranscriptionError>
Available on crate feature microphone and non-target_family=wasm only.
pub fn microphone( transcription: &'a Transcription<T, M, L>, language: &'a Language, ) -> Result<Self, TranscriptionError>
microphone and non-target_family=wasm only.Opens the microphone and records one utterance until stopped. finish
ends the recording; until then every Streaming step blocks on
captured audio.
Source§impl<'a, T: Transcriber, L: Layer> Session<'a, T, Streaming, L>
impl<'a, T: Transcriber, L: Layer> Session<'a, T, Streaming, L>
Sourcepub fn next_finalized(
&mut self,
) -> Result<Option<TranscriptSegment>, TranscriptionError>
pub fn next_finalized( &mut self, ) -> Result<Option<TranscriptSegment>, TranscriptionError>
The next committed stretch of words, or None once the input has
ended and the tail is delivered. Committed words are never revised.