Struct deepspeech::Stream
source · [−]pub struct Stream { /* private fields */ }
Implementations
sourceimpl Stream
impl Stream
sourcepub fn feed_audio(&mut self, buffer: &[i16])
pub fn feed_audio(&mut self, buffer: &[i16])
Feed audio samples to the stream
The input buffer must consist of mono 16-bit samples.
sourcepub fn intermediate_decode(&mut self) -> Result<String, DeepspeechError>
pub fn intermediate_decode(&mut self) -> Result<String, DeepspeechError>
Decodes the intermediate state of what has been spoken up until now
Note that as of DeepSpeech version 0.2.0, this function is non-trivial as the decoder can’t do streaming yet.
sourcepub fn finish(self) -> Result<String, DeepspeechError>
pub fn finish(self) -> Result<String, DeepspeechError>
Deallocates the stream and returns the decoded text
sourcepub fn finish_with_metadata(
self,
num_transcripts: u32
) -> Result<Metadata, DeepspeechError>
pub fn finish_with_metadata(
self,
num_transcripts: u32
) -> Result<Metadata, DeepspeechError>
Deallocates the stream and returns the extended metadata
The num_transcripts
param contains the maximum number of
CandidateTranscript
s to return. The actually returned number
might be smaller.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Stream
impl !Send for Stream
impl !Sync for Stream
impl Unpin for Stream
impl UnwindSafe for Stream
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more