Struct Model

Source
pub struct Model { /* private fields */ }

Implementations§

Source§

impl Model

Source

pub fn set_scorer_alpha_beta( &mut self, alpha: f32, beta: f32, ) -> Result<(), DeepspeechError>

Set hyperparameters alpha and beta of the external scorer

Source

pub fn enable_external_scorer( &mut self, scorer_path: &Path, ) -> Result<(), DeepspeechError>

Enable decoding using an external scorer

Source

pub fn get_sample_rate(&self) -> i32

Get sample rate expected by a model

Source

pub fn get_model_beam_width(&self) -> u16

Get beam width value the model is currently configured to use

Source

pub fn set_model_beam_width(&mut self, bw: u16) -> Result<(), DeepspeechError>

Set beam width value used by the model

Source

pub fn disable_external_scorer(&mut self) -> Result<(), DeepspeechError>

Disable decoding using an external scorer

Source

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.

Source

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 CandidateTranscripts to return. The actually returned number might be smaller.

Source

pub fn create_stream(&mut self) -> Result<Stream, DeepspeechError>

Set up a state for streaming inference

Source§

impl Model

Source

pub fn load_from_files(model_path: &Path) -> Result<Self, DeepspeechError>

Load a DeepSpeech model from the specified model file path

Trait Implementations§

Source§

impl Drop for Model

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl !Send for Model

§

impl !Sync for Model

§

impl Unpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.