### Setup Sherpa-onnx with Static Linking Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html Add this to your Cargo.toml to use the sherpa-onnx crate with its default static linking. The build script will automatically download prebuilt libraries if SHERPA_ONNX_LIB_DIR is not set. ```toml sherpa-onnx = "1.13.2" ``` -------------------------------- ### Setup Sherpa-onnx with Shared Libraries Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html To use shared libraries instead of static ones, disable the default features and enable the 'shared' feature in your Cargo.toml. ```toml sherpa-onnx = { version = "1.13.2", default-features = false, features = ["shared"] } ``` -------------------------------- ### Create and Use OfflineRecognizer Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineRecognizer.html Demonstrates how to create an OfflineRecognizer, configure it with model paths, create a stream, accept audio data, and decode it to get the recognized text. Ensure all model files are correctly specified. ```rust use sherpa_onnx::{ OfflineRecognizer, OfflineRecognizerConfig, OfflineTransducerModelConfig, Wave, }; let wave = Wave::read("./test.wav").expect("read wave"); let mut config = OfflineRecognizerConfig::default(); config.model_config.transducer = OfflineTransducerModelConfig { encoder: Some("./sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8/encoder.int8.onnx".into()), decoder: Some("./sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8/decoder.int8.onnx".into()), joiner: Some("./sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8/joiner.int8.onnx".into()), }; config.model_config.tokens = Some("./sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8/tokens.txt".into()); config.model_config.model_type = Some("nemo_transducer".into()); let recognizer = OfflineRecognizer::create(&config).expect("create recognizer"); let stream = recognizer.create_stream(); stream.accept_waveform(wave.sample_rate(), wave.samples()); recognizer.decode(&stream); let result = stream.get_result().expect("result"); println!("{}", result.text); ``` -------------------------------- ### Set SHERPA_ONNX_LIB_DIR for Advanced Setup Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html For advanced use cases, you can specify the directory containing sherpa-onnx libraries by setting the SHERPA_ONNX_LIB_DIR environment variable. This works for both static and shared builds. ```shell export SHERPA_ONNX_LIB_DIR=/path/to/sherpa-onnx/lib ``` -------------------------------- ### Offline ASR with SenseVoice Model Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html This example demonstrates how to perform offline Automatic Speech Recognition using the SenseVoice model. It involves reading a WAV file, configuring the recognizer with model paths and language settings, and decoding the audio stream. ```rust use sherpa_onnx::{ OfflineRecognizer, OfflineRecognizerConfig, OfflineSenseVoiceModelConfig, Wave, }; let wave = Wave::read("./test.wav").expect("read wave"); let mut config = OfflineRecognizerConfig::default(); config.model_config.sense_voice = OfflineSenseVoiceModelConfig { model: Some( "./sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17-int8/model.int8.onnx".into(), ), language: Some("auto".into()), use_itn: true, }; config.model_config.tokens = Some( "./sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17-int8/tokens.txt".into(), ); let recognizer = OfflineRecognizer::create(&config).expect("create recognizer"); let stream = recognizer.create_stream(); stream.accept_waveform(wave.sample_rate(), wave.samples()); recognizer.decode(&stream); let result = stream.get_result().expect("result"); println!("{}", result.text); ``` -------------------------------- ### Get Samples from CircularBuffer Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.CircularBuffer.html Copies a specified number of samples starting from a given index in the CircularBuffer. ```rust pub fn get(&self, start_index: i32, n: i32) -> Vec ``` -------------------------------- ### Get number of samples Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.Wave.html Returns the total number of samples in the waveform. ```rust pub fn num_samples(&self) -> i32 ``` -------------------------------- ### Default Implementation for OfflineTtsModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineTtsModelConfig.html Provides a default configuration for OfflineTtsModelConfig. This is useful for creating a basic setup without manually specifying all parameters. ```rust fn default() -> OfflineTtsModelConfig ``` -------------------------------- ### Get Start Index of SpeechSegment Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeechSegment.html Retrieves the start index of the speech segment in samples, relative to the input processed so far. ```rust pub fn start(&self) -> i32 ``` -------------------------------- ### CircularBuffer::get Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.CircularBuffer.html Copies a specified number of samples starting from a given index in the CircularBuffer. ```APIDOC ## CircularBuffer::get ### Description Copy `n` samples starting at `start_index`. ### Method `get(&self, start_index: i32, n: i32) -> Vec` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Vec) - A `Vec` containing the copied samples. #### Response Example None ``` -------------------------------- ### Get Stream Option Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineStream.html Retrieves the string value associated with a given option key from the stream. ```rust pub fn get_option(&self, key: &str) -> String ``` -------------------------------- ### Default SileroVadModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SileroVadModelConfig.html Provides the default configuration for the Silero VAD model. This is useful for quick setup when custom parameters are not immediately needed. ```rust fn default() -> SileroVadModelConfig ``` -------------------------------- ### Get Git Build Date Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.git_date.html Retrieves the Git date associated with the native library build. This can be useful for tracking build versions. ```rust pub fn git_date() -> &'static str ``` -------------------------------- ### Get Audio Sample Rate Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.GeneratedAudio.html Return the output sample rate of the generated audio in Hz. This is crucial for correctly interpreting the audio data. ```rust pub fn sample_rate(&self) -> i32 ``` -------------------------------- ### Get Segments Sorted by Start Time Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineSpeakerDiarizationResult.html Returns a vector of all diarization segments, ordered chronologically by their start time. ```rust pub fn sort_by_start_time(&self) -> Vec ``` -------------------------------- ### Create KeywordSpotter Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Creates a new KeywordSpotter instance from a given configuration. Returns None if creation fails. ```rust pub fn create(config: &KeywordSpotterConfig) -> Option ``` -------------------------------- ### Get sherpa-onnx Version Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.version.html Call the `version` function to retrieve the version string of the compiled sherpa-onnx native library. This function requires no arguments and returns a static string slice. ```rust pub fn version() -> &'static str ``` -------------------------------- ### KeywordSpotter::is_ready Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Checks if the provided online stream has accumulated enough audio data to perform the next decoding step. ```APIDOC ## KeywordSpotter::is_ready ### Description Return `true` if `stream` has enough audio for another decode step. ### Method ``` pub fn is_ready(&self, stream: &OnlineStream) -> bool ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **bool** - `true` if the stream is ready for decoding, `false` otherwise. #### Response Example None ``` -------------------------------- ### KeywordSpotter::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Creates a new KeywordSpotter instance from a given configuration. Returns None if the configuration is invalid or the spotter cannot be created. ```APIDOC ## KeywordSpotter::create ### Description Creates a keyword spotter from `KeywordSpotterConfig`. ### Method ``` pub fn create(config: &KeywordSpotterConfig) -> Option ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (Option) - An optional KeywordSpotter instance. #### Response Example None ``` -------------------------------- ### Get Embedding Dimension Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeakerEmbeddingExtractor.html Returns the dimension of the speaker embeddings that this extractor produces. ```rust pub fn dim(&self) -> i32 ``` -------------------------------- ### Create AudioTagger Instance Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTagging.html Creates a new AudioTagging instance using the provided configuration. Returns None if creation fails. ```rust pub fn create(config: &AudioTaggingConfig) -> Option ``` -------------------------------- ### Get Number of Segments Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineSpeakerDiarizationResult.html Retrieves the total count of diarization segments identified. ```rust pub fn num_segments(&self) -> i32 ``` -------------------------------- ### Get All Speaker Names Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeakerEmbeddingManager.html Retrieves a list of all speaker names currently stored in the SpeakerEmbeddingManager. ```rust pub fn get_all_speakers(&self) -> Vec ``` -------------------------------- ### DisplayManager::new Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.DisplayManager.html Creates a new, empty instance of the DisplayManager. ```APIDOC ## DisplayManager::new ### Description Creates an empty display manager. ### Method ```rust pub fn new() -> Self ``` ### Returns A new instance of `DisplayManager`. ``` -------------------------------- ### Get Logical Head Position of CircularBuffer Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.CircularBuffer.html Returns the logical head position of the CircularBuffer. ```rust pub fn head(&self) -> i32 ``` -------------------------------- ### Clone Implementation for KeywordSpotterConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotterConfig.html Provides methods to create a duplicate of a KeywordSpotterConfig instance or perform copy-assignment. ```rust fn clone(&self) -> KeywordSpotterConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Get Current Size of CircularBuffer Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.CircularBuffer.html Returns the current number of samples stored in the CircularBuffer. ```rust pub fn size(&self) -> i32 ``` -------------------------------- ### Get Number of Samples in Segment Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeechSegment.html Returns the total number of samples present in the speech segment. ```rust pub fn n(&self) -> i32 ``` -------------------------------- ### Create OnlineSpeechDenoiser Instance Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineSpeechDenoiser.html Creates a new instance of OnlineSpeechDenoiser using the provided configuration. Returns None if creation fails. ```rust pub fn create(config: &OnlineSpeechDenoiserConfig) -> Option ``` -------------------------------- ### AudioTagging::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTagging.html Creates an offline audio tagger instance from the provided configuration. Returns None if the configuration is invalid or the tagger cannot be initialized. ```APIDOC ## AudioTagging::create ### Description Creates a tagger from `config`. ### Method ``` pub fn create(config: &AudioTaggingConfig) -> Option ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (AudioTagging) - An instance of the AudioTagging struct. #### Response Example None ``` -------------------------------- ### Get Number of Speakers Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineSpeakerDiarizationResult.html Retrieves the total number of unique speakers detected in the diarization result. ```rust pub fn num_speakers(&self) -> i32 ``` -------------------------------- ### OnlinePunctuation::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlinePunctuation.html Creates a new instance of OnlinePunctuation with the given configuration. ```APIDOC ## OnlinePunctuation::create ### Description Creates a new instance of `OnlinePunctuation` with the given configuration. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method ``` pub fn create(config: &OnlinePunctuationConfig) -> Option ``` ### Returns An `Option` which is `Some(OnlinePunctuation)` on success, or `None` if creation fails. ``` -------------------------------- ### Initialize and Use Streaming Recognizer Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html This snippet shows how to configure and use the `OnlineRecognizer` for streaming speech recognition. Ensure all model paths in the configuration are correct. ```rust use sherpa_onnx::{OnlineRecognizer, OnlineRecognizerConfig, Wave}; let wave = Wave::read("./test.wav").expect("read wave"); let mut config = OnlineRecognizerConfig::default(); config.model_config.transducer.encoder = Some( "./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.int8.onnx".into(), ); config.model_config.transducer.decoder = Some( "./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx".into(), ); config.model_config.transducer.joiner = Some( "./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.int8.onnx".into(), ); config.model_config.tokens = Some( "./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt".into(), ); config.enable_endpoint = true; config.decoding_method = Some("greedy_search".into()); let recognizer = OnlineRecognizer::create(&config).expect("create recognizer"); let stream = recognizer.create_stream(); stream.accept_waveform(wave.sample_rate(), wave.samples()); stream.input_finished(); while recognizer.is_ready(&stream) { recognizer.decode(&stream); } ``` -------------------------------- ### Get Output Sample Rate Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.LinearResampler.html Retrieves the configured output sample rate of the resampler in Hz. ```rust pub fn output_sample_rate(&self) -> i32 ``` -------------------------------- ### Get Input Sample Rate Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.LinearResampler.html Retrieves the configured input sample rate of the resampler in Hz. ```rust pub fn input_sample_rate(&self) -> i32 ``` -------------------------------- ### Get Recognition Result Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizer.html Fetches the current recognition hypothesis for a given stream. Returns None if no result is available. ```rust pub fn get_result(&self, stream: &OnlineStream) -> Option ``` -------------------------------- ### Clone Implementation for OfflineQwen3ASRModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineQwen3ASRModelConfig.html Enables cloning an existing OfflineQwen3ASRModelConfig instance. This is useful for creating copies of configurations or for passing configurations by value. ```rust fn clone(&self) -> OfflineQwen3ASRModelConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### OfflineStream::get_result Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineStream.html Fetches the current recognition result from the stream. This method can be called periodically to get intermediate or final results. ```APIDOC ## OfflineStream::get_result ### Description Fetch the current recognition result. ### Method `get_result(&self) -> Option` ### Returns - `Option` - An optional `OfflineRecognizerResult` containing the recognition result, or `None` if no result is available yet. ``` -------------------------------- ### write Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html Writes normalized PCM samples to a WAV file. ```APIDOC ## write ### Description Write normalized PCM samples to a WAV file. ### Parameters #### Path Parameters - **filename** (string) - Required - The name of the WAV file to write. - **samples** (array of floats) - Required - The normalized PCM samples to write. ``` -------------------------------- ### CloneToUninit (Nightly) Implementation Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioEvent.html An experimental nightly feature that allows cloning an AudioEvent directly into uninitialized memory. Use with caution as it is unstable. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### RecognizerResult Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.RecognizerResult.html Defines the structure for ASR results, including text, tokens, timestamps, segment, start time, and finality. ```rust pub struct RecognizerResult { pub text: String, pub tokens: Vec, pub timestamps: Option>, pub segment: Option, pub start_time: Option, pub is_final: bool, } ``` -------------------------------- ### KeywordSpotter::create_stream_with_keywords Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Creates an online stream for this KeywordSpotter, specifically using a provided string of keywords, overriding any pre-configured list. ```APIDOC ## KeywordSpotter::create_stream_with_keywords ### Description Creates a stream that uses `keywords` instead of the configured keyword list. ### Method ``` pub fn create_stream_with_keywords(&self, keywords: &str) -> OnlineStream ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **OnlineStream** - An OnlineStream object configured with the specified keywords. #### Response Example None ``` -------------------------------- ### OfflineSpeakerDiarizationSegment Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineSpeakerDiarizationSegment.html Defines the structure for an offline speaker diarization segment, including start and end times, and the speaker index. ```rust pub struct OfflineSpeakerDiarizationSegment { pub start: f32, pub end: f32, pub speaker: i32, } ``` -------------------------------- ### Get OnlineSpeechDenoiser Frame Shift Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineSpeechDenoiser.html Returns the preferred input frame shift in samples, indicating the optimal chunk size for processing. ```rust pub fn frame_shift_in_samples(&self) -> i32 ``` -------------------------------- ### OnlineRecognizer::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizer.html Creates a new OnlineRecognizer instance from the provided configuration. Returns None if the configuration is invalid or the recognizer cannot be created. ```APIDOC ## OnlineRecognizer::create ### Description Creates a recognizer from `config`. ### Method ``` pub fn create(config: &OnlineRecognizerConfig) -> Option ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (Option) - A new OnlineRecognizer instance or None. #### Response Example None ``` -------------------------------- ### Get Keyword Spotting Result Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Retrieves the structured keyword spotting result for a given stream. Returns None if no result is available. ```rust pub fn get_result(&self, stream: &OnlineStream) -> Option ``` -------------------------------- ### Initialize and Use Offline TTS Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/index.html This snippet demonstrates how to set up and use the `OfflineTts` for text-to-speech synthesis. Ensure all model paths within the `OfflineTtsConfig` are correctly specified. ```rust use sherpa_onnx::{OfflineTts, OfflineTtsConfig, OfflineTtsModelConfig, OfflineTtsPocketModelConfig}; let config = OfflineTtsConfig { model: OfflineTtsModelConfig { pocket: OfflineTtsPocketModelConfig { lm_flow: Some("./sherpa-onnx-pocket-tts-int8-2026-01-26/lm_flow.int8.onnx".into()), lm_main: Some("./sherpa-onnx-pocket-tts-int8-2026-01-26/lm_main.int8.onnx".into()), encoder: Some("./sherpa-onnx-pocket-tts-int8-2026-01-26/encoder.onnx".into()), decoder: Some("./sherpa-onnx-pocket-tts-int8-2026-01-26/decoder.int8.onnx".into()), text_conditioner: Some( "./sherpa-onnx-pocket-tts-int8-2026-01-26/text_conditioner.onnx".into(), ), vocab_json: Some("./sherpa-onnx-pocket-tts-int8-2026-01-26/vocab.json".into()), token_scores_json: Some( "./sherpa-onnx-pocket-tts-int8-2026-01-26/token_scores.json".into(), ), ..Default::default() }, ..Default::default() }, ..Default::default() }; let tts = OfflineTts::create(&config).expect("create tts"); println!("{}", tts.sample_rate()); ``` -------------------------------- ### Default Implementation for OnlineSpeechDenoiserConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineSpeechDenoiserConfig.html Provides a default configuration for OnlineSpeechDenoiserConfig, allowing for easy initialization. ```rust fn default() -> OnlineSpeechDenoiserConfig ``` -------------------------------- ### From and Into Trait Implementations Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingModelConfig.html Facilitates conversions to and from AudioTaggingModelConfig. ```rust fn from(t: T) -> T ``` ```rust fn into(self) -> U ``` -------------------------------- ### Create New DisplayManager Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.DisplayManager.html Instantiates an empty DisplayManager. This is the constructor for the struct. ```rust pub fn new() -> Self ``` -------------------------------- ### Create Keyword Spotting Stream Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Creates a new online stream for keyword spotting using the keywords configured in the KeywordSpotterConfig. ```rust pub fn create_stream(&self) -> OnlineStream ``` -------------------------------- ### OfflineRecognizerConfig Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineRecognizerConfig.html Defines the structure for configuring an offline speech recognizer. Use `Default` as a starting point and then customize fields for your specific model. ```rust pub struct OfflineRecognizerConfig { pub feat_config: FeatureConfig, pub model_config: OfflineModelConfig, pub lm_config: OfflineLMConfig, pub decoding_method: Option, pub max_active_paths: i32, pub hotwords_file: Option, pub hotwords_score: f32, pub rule_fsts: Option, pub rule_fars: Option, pub blank_penalty: f32, pub hr: HomophoneReplacerConfig, } ``` -------------------------------- ### VoiceActivityDetector::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.VoiceActivityDetector.html Creates a new VoiceActivityDetector instance with the specified configuration and buffer size. Returns None if initialization fails. ```APIDOC ## VoiceActivityDetector::create ### Description Create a detector and an internal result buffer. ### Method Signature `pub fn create(config: &VadModelConfig, buffer_size_in_seconds: f32) -> Option` ### Parameters * `config` (*VadModelConfig*) - Configuration for the VAD model. * `buffer_size_in_seconds` (*f32*) - The size of the internal buffer in seconds. ``` -------------------------------- ### Get Result as JSON String Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Retrieves the keyword spotting result for a given stream formatted as a JSON string. Returns None if no result is available. ```rust pub fn get_result_as_json(&self, stream: &OnlineStream) -> Option ``` -------------------------------- ### Clone Implementation for FastClusteringConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.FastClusteringConfig.html Enables duplication of FastClusteringConfig instances. Use `clone()` to create a copy of an existing configuration. ```rust fn clone(&self) -> FastClusteringConfig ``` -------------------------------- ### Default Implementation for OnlinePunctuationConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlinePunctuationConfig.html Provides a default value for OnlinePunctuationConfig, allowing for easy initialization. ```rust fn default() -> OnlinePunctuationConfig ``` -------------------------------- ### Get Top Speaker Matches Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeakerEmbeddingManager.html Retrieves up to 'n' best matching speaker names for a given embedding, provided they exceed the specified threshold. Returns a vector of SpeakerEmbeddingMatch. ```rust pub fn get_best_matches( &self, embedding: &[f32], threshold: f32, n: i32, ) -> Vec ``` -------------------------------- ### KeywordSpotter::create_stream Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Creates an online stream associated with this KeywordSpotter, using the keywords pre-configured in its KeywordSpotterConfig. ```APIDOC ## KeywordSpotter::create_stream ### Description Creates a stream that uses the keywords configured in `KeywordSpotterConfig`. ### Method ``` pub fn create_stream(&self) -> OnlineStream ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **OnlineStream** - An OnlineStream object configured with the spotter's keywords. #### Response Example None ``` -------------------------------- ### Get Git SHA1 of Native Library Build Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.git_sha1.html Call this function to retrieve the Git SHA1 hash of the native library build. This can be useful for version checking or debugging. ```rust pub fn git_sha1() -> &'static str ``` -------------------------------- ### Create OnlineRecognizer Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizer.html Creates a new OnlineRecognizer instance from a given configuration. Returns None if creation fails. ```rust pub fn create(config: &OnlineRecognizerConfig) -> Option ``` -------------------------------- ### Create Stream with Specific Keywords Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Creates a new online stream for keyword spotting using a custom set of keywords provided as a string. ```rust pub fn create_stream_with_keywords(&self, keywords: &str) -> OnlineStream ``` -------------------------------- ### version() Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.version.html Retrieves the version string of the compiled Sherpa-onnx native library. ```APIDOC ## version() ### Description Returns the sherpa-onnx version string compiled into the native library. ### Function Signature ```rust pub fn version() -> &'static str ``` ### Returns - `&'static str`: The Sherpa-onnx version string. ``` -------------------------------- ### Default OnlineToneCtcModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineToneCtcModelConfig.html Provides the default configuration for OnlineToneCtcModelConfig. ```rust fn default() -> OnlineToneCtcModelConfig ``` -------------------------------- ### Default Implementation for OfflineWenetCtcModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineWenetCtcModelConfig.html Provides a default configuration for OfflineWenetCtcModelConfig. ```rust fn default() -> OfflineWenetCtcModelConfig ``` -------------------------------- ### Write PCM Samples to WAV File Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.write.html Use this function to directly write normalized PCM samples to a WAV file. It requires the output filename, a slice of f32 samples, and the audio sample rate. ```rust pub fn write(filename: &str, samples: &[f32], sample_rate: i32) -> bool ``` -------------------------------- ### KeywordSpotterConfig Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotterConfig.html Defines the configuration structure for KeywordSpotter, including feature and model configurations, path limits, and keyword-specific settings. ```rust pub struct KeywordSpotterConfig { pub feat_config: FeatureConfig, pub model_config: OnlineModelConfig, pub max_active_paths: i32, pub num_trailing_blanks: i32, pub keywords_score: f32, pub keywords_threshold: f32, pub keywords_file: Option, pub keywords_buf: Option, } ``` -------------------------------- ### Access Generated Audio Samples Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.GeneratedAudio.html Borrow the generated audio samples as a slice of f32. This method is used to access the raw audio data. ```rust pub fn samples(&self) -> &[f32] ``` -------------------------------- ### LinearResampler::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.LinearResampler.html Creates a new LinearResampler instance to convert audio from an input sample rate to an output sample rate. ```APIDOC ## LinearResampler::create ### Description Creates a new resampler that converts from `samp_rate_in_hz` to `samp_rate_out_hz`. ### Method ```rust pub fn create(samp_rate_in_hz: i32, samp_rate_out_hz: i32) -> Option ``` ### Parameters * `samp_rate_in_hz` (i32) - The input sample rate in Hz. * `samp_rate_out_hz` (i32) - The output sample rate in Hz. ### Returns An `Option` containing the new `LinearResampler` if successful, otherwise `None`. ``` -------------------------------- ### Create Online Stream with Hotwords Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizer.html Creates a new online stream that is pre-configured with specific hotwords for this stream only. ```rust pub fn create_stream_with_hotwords(&self, hotwords: &str) -> OnlineStream ``` -------------------------------- ### TryFrom and TryInto Trait Implementations Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingModelConfig.html Enables fallible conversions to and from AudioTaggingModelConfig. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Clone Implementation for OnlineSpeechDenoiserConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineSpeechDenoiserConfig.html Provides methods to create a duplicate of an OnlineSpeechDenoiserConfig or copy assignment from another instance. ```rust fn clone(&self) -> OnlineSpeechDenoiserConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Clone Implementation for OfflineLMConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineLMConfig.html Provides the ability to create a duplicate of an OfflineLMConfig instance. This is useful for copying configuration settings. ```rust fn clone(&self) -> OfflineLMConfig ``` -------------------------------- ### OfflineQwen3ASRModelConfig Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineQwen3ASRModelConfig.html Defines the configuration parameters for an offline Qwen3 ASR model. This includes settings for the model's frontend, encoder, decoder, tokenizer, and various generation parameters like temperature and seed. ```rust pub struct OfflineQwen3ASRModelConfig { pub conv_frontend: Option, pub encoder: Option, pub decoder: Option, pub tokenizer: Option, pub max_total_len: i32, pub max_new_tokens: i32, pub temperature: f32, pub top_p: f32, pub seed: i32, pub hotwords: Option, } ``` -------------------------------- ### Default Implementation for AudioTaggingModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingModelConfig.html Provides a default value for AudioTaggingModelConfig, useful for initialization. ```rust fn default() -> Self ``` -------------------------------- ### Create VoiceActivityDetector Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.VoiceActivityDetector.html Creates a new VoiceActivityDetector instance with a specified model configuration and buffer size. Returns None if creation fails. ```rust pub fn create( config: &VadModelConfig, buffer_size_in_seconds: f32, ) -> Option ``` -------------------------------- ### Run OfflineSpeechDenoiser Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineSpeechDenoiser.html Processes a chunk or a complete waveform of audio samples for denoising. Requires the audio samples and their sample rate. ```rust pub fn run(&self, samples: &[f32], sample_rate: i32) -> DenoisedAudio ``` -------------------------------- ### Default Implementation for OnlineTransducerModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineTransducerModelConfig.html Provides a default configuration for OnlineTransducerModelConfig. This is useful for initializing the struct with sensible defaults. ```rust fn default() -> OnlineTransducerModelConfig ``` -------------------------------- ### Clone Implementation for OfflineWenetCtcModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineWenetCtcModelConfig.html Provides methods to create a duplicate of the configuration or perform copy-assignment. ```rust fn clone(&self) -> OfflineWenetCtcModelConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Clone OnlineToneCtcModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineToneCtcModelConfig.html Enables creating a duplicate of an OnlineToneCtcModelConfig instance. ```rust fn clone(&self) -> OnlineToneCtcModelConfig ``` -------------------------------- ### OnlineRecognizer::is_ready Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizer.html Determines if the recognizer has received enough audio data to perform another recognition step. ```APIDOC ## OnlineRecognizer::is_ready ### Description Return `true` if the recognizer has enough audio to run another step. ### Method ``` pub fn is_ready(&self, stream: &OnlineStream) -> bool ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **bool** - `true` if the recognizer is ready for another step, `false` otherwise. #### Response Example None ``` -------------------------------- ### write Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.write.html Writes normalized PCM samples to a WAV file. This function is useful for directly saving audio data without needing to construct a `Wave` object first. ```APIDOC ## write ### Description Write normalized PCM samples to a WAV file. This is convenient when an API returns a plain `Vec` and you do not need to build a `Wave` first. ### Signature ```rust pub fn write(filename: &str, samples: &[f32], sample_rate: i32) -> bool ``` ### Parameters * **filename** (`&str`): The name of the WAV file to write. * **samples** (`&[f32]`): A slice of normalized PCM samples. * **sample_rate** (`i32`): The sample rate of the audio data. ### Returns * `bool`: Returns `true` if the samples were written successfully, `false` otherwise. ``` -------------------------------- ### Default Implementation for OfflineFireRedAsrModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineFireRedAsrModelConfig.html Provides a default configuration for OfflineFireRedAsrModelConfig, allowing for easy initialization. ```rust fn default() -> OfflineFireRedAsrModelConfig ``` -------------------------------- ### GeneratedAudio PinDrop Implementation (Nightly) Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.GeneratedAudio.html Executes the destructor for the GeneratedAudio type requiring the instance to be pinned. This is an experimental, nightly-only API. ```rust fn pin_drop(self: Pin<&mut Self>) ``` -------------------------------- ### Create LinearResampler Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.LinearResampler.html Creates a new LinearResampler instance. Specify the input and output sample rates in Hz. Returns None if the sample rates are invalid. ```rust pub fn create(samp_rate_in_hz: i32, samp_rate_out_hz: i32) -> Option ``` -------------------------------- ### Clone Implementation for AudioTaggingConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingConfig.html Provides methods to create a duplicate of an AudioTaggingConfig value or perform copy-assignment. ```rust fn clone(&self) -> AudioTaggingConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Default Implementation for OnlineNemoCtcModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineNemoCtcModelConfig.html Provides a default configuration for OnlineNemoCtcModelConfig. ```rust fn default() -> OnlineNemoCtcModelConfig ``` -------------------------------- ### Default Implementation for OnlineZipformer2CtcModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineZipformer2CtcModelConfig.html Provides a default configuration for OnlineZipformer2CtcModelConfig. Use this when no specific configuration is needed. ```rust fn default() -> OnlineZipformer2CtcModelConfig ``` -------------------------------- ### Clone Implementation for OnlineRecognizerConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizerConfig.html Provides methods to duplicate an OnlineRecognizerConfig instance. This is useful for creating independent configurations. ```rust fn clone(&self) -> OnlineRecognizerConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Create SpokenLanguageIdentification Instance Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpokenLanguageIdentification.html Creates a language identifier instance using the provided configuration. Returns None if creation fails. ```rust pub fn create(config: &SpokenLanguageIdentificationConfig) -> Option ``` -------------------------------- ### Create SpeakerEmbeddingExtractor Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeakerEmbeddingExtractor.html Creates a new SpeakerEmbeddingExtractor instance from a given configuration. Returns None if creation fails. ```rust pub fn create(config: &SpeakerEmbeddingExtractorConfig) -> Option ``` -------------------------------- ### CloneToUninit Trait Implementation Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineTdnnModelConfig.html Nightly-only experimental API for performing copy-assignment to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Clone Implementation for AudioTaggingModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingModelConfig.html Provides methods to duplicate and copy-assign AudioTaggingModelConfig values. ```rust fn clone(&self) -> AudioTaggingModelConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Clone Implementation for OnlinePunctuationModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlinePunctuationModelConfig.html Enables creating a duplicate of an existing OnlinePunctuationModelConfig instance. This is useful for modifying configurations without affecting the original. ```rust fn clone(&self) -> OnlinePunctuationModelConfig ``` -------------------------------- ### AudioTaggingConfig Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingConfig.html Defines the top-level configuration for audio tagging, including model, labels, and top-k parameters. ```rust pub struct AudioTaggingConfig { pub model: AudioTaggingModelConfig, pub labels: Option, pub top_k: i32, } ``` -------------------------------- ### OnlineSpeechDenoiser Methods Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineSpeechDenoiser.html Provides methods for interacting with the OnlineSpeechDenoiser, including creation, processing audio chunks, flushing remaining data, resetting state, and retrieving model parameters. ```APIDOC ## OnlineSpeechDenoiser Streaming speech denoiser. ### `create(config: &OnlineSpeechDenoiserConfig) -> Option` **Description**: Creates a new instance of `OnlineSpeechDenoiser` based on the provided configuration. **Method**: `create` **Parameters**: * `config` (&OnlineSpeechDenoiserConfig) - Required - The configuration for the denoiser. **Returns**: An `Option` which is `Some(OnlineSpeechDenoiser)` if creation is successful, `None` otherwise. ### `run(&self, samples: &[f32], sample_rate: i32) -> DenoisedAudio` **Description**: Processes an input chunk of audio samples to denoise them. **Method**: `run` **Parameters**: * `samples` (&[f32]) - Required - A slice of f32 representing the audio samples. * `sample_rate` (i32) - Required - The sample rate of the input audio. **Returns**: A `DenoisedAudio` struct containing the denoised audio data. ### `flush(&self) -> DenoisedAudio` **Description**: Flushes any internally buffered samples after the final audio chunk has been processed. **Method**: `flush` **Returns**: A `DenoisedAudio` struct containing any remaining denoised audio data. ### `reset(&self)` **Description**: Resets the internal streaming state of the denoiser. **Method**: `reset` ### `sample_rate(&self) -> i32` **Description**: Returns the sample rate that the denoiser model expects. **Method**: `sample_rate` **Returns**: An i32 representing the model's sample rate. ### `frame_shift_in_samples(&self) -> i32` **Description**: Returns the preferred input frame shift in samples. **Method**: `frame_shift_in_samples` **Returns**: An i32 representing the preferred frame shift in samples. ``` -------------------------------- ### Clone Implementation for OnlineModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineModelConfig.html Enables creating a deep copy of an existing OnlineModelConfig instance. ```rust fn clone(&self) -> OnlineModelConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Wave::samples Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.Wave.html Provides access to the normalized PCM samples of the waveform. ```APIDOC ## Wave::samples ### Description Return the normalized PCM samples. ### Method `pub fn samples(&self) -> &[f32]` ### Response #### Success Response - **&[f32]** - A slice containing the normalized f32 PCM samples. ``` -------------------------------- ### Accept Waveform Samples Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.AudioTaggingOfflineStream.html Appends waveform samples to the audio tagging stream. This method is part of the AudioTaggingOfflineStream's implementation. ```rust pub fn accept_waveform(&self, sample_rate: i32, samples: &[f32]) ``` -------------------------------- ### SpeakerEmbeddingExtractor::create Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeakerEmbeddingExtractor.html Creates a new SpeakerEmbeddingExtractor instance from the provided configuration. Returns None if the configuration is invalid. ```APIDOC ## SpeakerEmbeddingExtractor::create ### Description Create an extractor from `config`. ### Method ``` pub fn create(config: &SpeakerEmbeddingExtractorConfig) -> Option ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (SpeakerEmbeddingExtractor) - An instance of SpeakerEmbeddingExtractor if creation is successful. #### Response Example ```json { "example": "Some(SpeakerEmbeddingExtractor { ... })" } ``` ``` -------------------------------- ### KeywordSpotter::decode Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Performs one incremental decoding step for the given online stream. ```APIDOC ## KeywordSpotter::decode ### Description Decode one incremental step for `stream`. ### Method ``` pub fn decode(&self, stream: &OnlineStream) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response None #### Response Example None ``` -------------------------------- ### OfflineTts::generate_with_config Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineTts.html Generates audio for the given text using the specified configuration and an optional callback for progress updates. ```APIDOC ## OfflineTts::generate_with_config ### Description Generate audio for `text`. The optional callback receives the samples generated so far together with a progress value in `[0, 1]`. Return `true` to continue and `false` to stop early. ### Method `pub fn generate_with_config( &self, text: &str, config: &GenerationConfig, callback: Option, ) -> Option where F: FnMut(&[f32], f32) -> bool + 'static` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **text** (`&str`) - Required - The text to synthesize. * **config** (`&GenerationConfig`) - Required - Configuration for audio generation. * **callback** (`Option`) - Optional - A closure that receives generated audio samples and progress. ### Request Example ```rust // Assuming GenerationConfig and GeneratedAudio are defined elsewhere // let generation_config = GenerationConfig { ... }; // let callback = |samples: &[f32], progress: f32| -> bool { // println!("Progress: {:.2}", progress); // true // Continue generation // }; // let audio_result = tts.generate_with_config("Hello world", &generation_config, Some(callback)); ``` ### Response #### Success Response (Option) * **GeneratedAudio** - An object containing the generated audio data and sample rate. #### Response Example `Some(GeneratedAudio { samples: vec![...], sample_rate: 48000 })` or `None` ``` -------------------------------- ### Check Stream Readiness for Decoding Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordSpotter.html Determines if the provided stream has accumulated enough audio data to perform another decoding step. ```rust pub fn is_ready(&self, stream: &OnlineStream) -> bool ``` -------------------------------- ### Clone Implementation for OfflineZipformerAudioTaggingModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineZipformerAudioTaggingModelConfig.html Provides methods to create a duplicate of the configuration or perform copy-assignment. ```rust fn clone(&self) -> OfflineZipformerAudioTaggingModelConfig ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Generic Implementations for OnlineRecognizerConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineRecognizerConfig.html Shows various blanket implementations for traits like Send, Sync, and Any, indicating that OnlineRecognizerConfig can be safely shared across threads and used in generic contexts. ```rust impl Any for T where T: 'static + ?Sized, ``` ```rust fn type_id(&self) -> TypeId ``` ```rust impl Borrow for T where T: ?Sized, ``` ```rust fn borrow(&self) -> &T ``` ```rust impl BorrowMut for T where T: ?Sized, ``` ```rust fn borrow_mut(&mut self) -> &mut T ``` ```rust impl CloneToUninit for T where T: Clone, ``` ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` ```rust impl From for T ``` ```rust fn from(t: T) -> T ``` ```rust impl Into for T where U: From, ``` ```rust fn into(self) -> U ``` ```rust impl ToOwned for T where T: Clone, ``` ```rust type Owned = T ``` ```rust fn to_owned(&self) -> T ``` ```rust fn clone_into(&self, target: &mut T) ``` ```rust impl TryFrom for T where U: Into, ``` ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust impl TryInto for T where U: TryFrom, ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### file_exists Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/fn.file_exists.html Checks if a file exists using the native file system helper. It takes a filename as input and returns a boolean indicating its existence. ```APIDOC ## file_exists ### Description Returns `true` if `filename` exists according to the native helper. ### Signature ```rust pub fn file_exists(filename: &str) -> bool ``` ### Parameters #### Path Parameters - **filename** (str) - The name of the file to check for existence. ``` -------------------------------- ### Create OfflineSpeechDenoiser Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineSpeechDenoiser.html Creates an OfflineSpeechDenoiser instance from the provided configuration. Returns None if creation fails. ```rust pub fn create(config: &OfflineSpeechDenoiserConfig) -> Option ``` -------------------------------- ### Clone Implementation for OnlineTransducerModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlineTransducerModelConfig.html Allows creating a duplicate of an OnlineTransducerModelConfig instance. This is useful when you need to modify a configuration without affecting the original. ```rust fn clone(&self) -> OnlineTransducerModelConfig ``` -------------------------------- ### Create OnlineStream for SpeakerEmbeddingExtractor Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpeakerEmbeddingExtractor.html Creates an audio stream associated with the SpeakerEmbeddingExtractor. This stream can then be populated with audio data. ```rust pub fn create_stream(&self) -> Option ``` -------------------------------- ### Default Implementation for TenVadModelConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.TenVadModelConfig.html Provides a default configuration for the TenVadModelConfig struct. ```rust fn default() -> TenVadModelConfig ``` -------------------------------- ### Generic CloneToUninit Implementation Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OfflineTtsKittenModelConfig.html An experimental nightly-only API that allows cloning a value into uninitialized memory. Requires the type to implement the Clone trait. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) Source ``` -------------------------------- ### Default Implementation for SpokenLanguageIdentificationWhisperConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpokenLanguageIdentificationWhisperConfig.html Provides a default configuration for SpokenLanguageIdentificationWhisperConfig. This is useful for initializing the struct with standard values. ```rust fn default() -> SpokenLanguageIdentificationWhisperConfig ``` -------------------------------- ### Clone Implementation for SpokenLanguageIdentificationWhisperConfig Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.SpokenLanguageIdentificationWhisperConfig.html Enables creating a duplicate of an existing SpokenLanguageIdentificationWhisperConfig instance. This is useful for modifying configurations without affecting the original. ```rust fn clone(&self) -> SpokenLanguageIdentificationWhisperConfig ``` -------------------------------- ### OnlinePunctuationModelConfig Struct Definition Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.OnlinePunctuationModelConfig.html Defines the configuration options for an online punctuation restoration model, including paths to CNN-BiLSTM and BPE vocabulary files, number of threads, debug flag, and provider. ```rust pub struct OnlinePunctuationModelConfig { pub cnn_bilstm: Option, pub bpe_vocab: Option, pub num_threads: i32, pub debug: bool, pub provider: Option, } ``` -------------------------------- ### Generic Blanket Implementations Source: https://docs.rs/sherpa-onnx/latest/sherpa_onnx/struct.KeywordResult.html Showcases various blanket implementations available for the KeywordResult struct, including Any, Borrow, CloneToUninit, From, Into, ToOwned, TryFrom, and TryInto. ```rust fn type_id(&self) -> TypeId ``` ```rust fn borrow(&self) -> &T ``` ```rust fn borrow_mut(&mut self) -> &mut T ``` ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` ```rust fn from(t: T) -> T ``` ```rust fn into(self) -> U ``` ```rust type Owned = T ``` ```rust fn to_owned(&self) -> T ``` ```rust fn clone_into(&self, target: &mut T) ``` ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ```