Struct deepspeech::Model
source · [−]pub struct Model { /* private fields */ }
Implementations
sourceimpl 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
sourceimpl 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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Model
impl !Send for Model
impl !Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
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