Struct deepspeech::Model
source · pub struct Model { /* private fields */ }
Implementations§
source§impl Model
impl Model
sourcepub fn load_from_files(
model_path: &Path,
n_cep: u16,
n_context: u16,
alphabet_path: &Path,
beam_width: u16
) -> Result<Self, ()>
pub fn load_from_files(
model_path: &Path,
n_cep: u16,
n_context: u16,
alphabet_path: &Path,
beam_width: u16
) -> Result<Self, ()>
Load a DeepSpeech model from the specified model and alphabet file paths
sourcepub fn enable_decoder_with_lm(
&mut self,
alphabet_path: &Path,
language_model_path: &Path,
trie_path: &Path,
weight: f32,
valid_word_count_weight: f32
)
pub fn enable_decoder_with_lm(
&mut self,
alphabet_path: &Path,
language_model_path: &Path,
trie_path: &Path,
weight: f32,
valid_word_count_weight: f32
)
Load a KenLM language model from a file and enable decoding using beam scoring
sourcepub fn speech_to_text(
&mut self,
buffer: &[i16],
sample_rate: u32
) -> Result<String, FromUtf8Error>
pub fn speech_to_text(
&mut self,
buffer: &[i16],
sample_rate: u32
) -> Result<String, FromUtf8Error>
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.