pub struct Model { /* private fields */ }
Implementations§
Source§impl Model
impl Model
Sourcepub fn set_scorer_alpha_beta(
&mut self,
alpha: f32,
beta: f32,
) -> Result<(), DeepspeechError>
pub fn set_scorer_alpha_beta( &mut self, alpha: f32, beta: f32, ) -> Result<(), DeepspeechError>
Set hyperparameters alpha and beta of the external scorer
Sourcepub fn enable_external_scorer(
&mut self,
scorer_path: &Path,
) -> Result<(), DeepspeechError>
pub fn enable_external_scorer( &mut self, scorer_path: &Path, ) -> Result<(), DeepspeechError>
Enable decoding using an external scorer
Sourcepub fn get_sample_rate(&self) -> i32
pub fn get_sample_rate(&self) -> i32
Get sample rate expected by a model
Sourcepub fn get_model_beam_width(&self) -> u16
pub fn get_model_beam_width(&self) -> u16
Get beam width value the model is currently configured to use
Sourcepub fn set_model_beam_width(&mut self, bw: u16) -> Result<(), DeepspeechError>
pub fn set_model_beam_width(&mut self, bw: u16) -> Result<(), DeepspeechError>
Set beam width value used by the model
Sourcepub fn disable_external_scorer(&mut self) -> Result<(), DeepspeechError>
pub fn disable_external_scorer(&mut self) -> Result<(), DeepspeechError>
Disable decoding using an external scorer
Sourcepub fn speech_to_text(
&mut self,
buffer: &[i16],
) -> Result<String, DeepspeechError>
pub fn speech_to_text( &mut self, buffer: &[i16], ) -> Result<String, DeepspeechError>
Perform speech-to-text using the model
The input buffer must consist of mono 16-bit samples. The sample rate is not freely chooseable but a property of the model files.
Sourcepub fn speech_to_text_with_metadata(
&mut self,
buffer: &[i16],
num_transcripts: u16,
) -> Result<Metadata, DeepspeechError>
pub fn speech_to_text_with_metadata( &mut self, buffer: &[i16], num_transcripts: u16, ) -> Result<Metadata, DeepspeechError>
Perform speech-to-text using the model, getting extended metadata
The input buffer must consist of mono 16-bit samples. The sample rate is not freely chooseable but a property of the model files.
The num_transcripts
param contains the maximum number of
CandidateTranscript
s to return. The actually returned number
might be smaller.
Sourcepub fn create_stream(&mut self) -> Result<Stream, DeepspeechError>
pub fn create_stream(&mut self) -> Result<Stream, DeepspeechError>
Set up a state for streaming inference
Source§impl Model
impl Model
Sourcepub fn load_from_files(model_path: &Path) -> Result<Self, DeepspeechError>
pub fn load_from_files(model_path: &Path) -> Result<Self, DeepspeechError>
Load a DeepSpeech model from the specified model file path