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. stop 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; stop only waits for that end and finishes the transcript.
Sourcepub fn stop(self) -> Result<Transcript, TranscriptionError>
pub fn stop(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. stop
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.
Sourcepub fn hearing<E: Embedder>(
self,
voices: Diarizer<E>,
) -> Result<HeardSession<'a, T, E, L>, VoiceActivityError>
Available on crate feature silero and non-target_family=wasm only.
pub fn hearing<E: Embedder>( self, voices: Diarizer<E>, ) -> Result<HeardSession<'a, T, E, L>, VoiceActivityError>
silero and non-target_family=wasm only.The same session, with every committed segment’s voice named by
voices, behind the bundled speech gate.
Sourcepub fn with_reader<E: Embedder>(
self,
reader: SegmentReader<E>,
) -> HeardSession<'a, T, E, L>
Available on crate feature silero and non-target_family=wasm only.
pub fn with_reader<E: Embedder>( self, reader: SegmentReader<E>, ) -> HeardSession<'a, T, E, L>
silero and non-target_family=wasm only.The same session, with every committed segment judged by a reader the caller built.