Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidCiOSPythonWeb
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Rhino Speech-to-Intent — Rust API


API Reference for the Rhino Rust SDK (crates.io ).


rhino::Rhino

pub struct Rhino

Struct for the Rhino Speech-to-Intent engine.


rhino::Rhino.process()

pub fn process(&self, pcm: &[i16]) -> Result<bool, RhinoError>

Process a frame of pcm audio with the Speech-to-Intent engine.

Parameters

  • pcm &[i16] : A frame of audio samples.

Returns

  • Result<bool, RhinoError> : If Ok, indicates whether Rhino has an inference ready or not. If Err, a RhinoError object describing the error that was encountered.

rhino::Rhino.get_inference()

pub fn get_inference(&self) -> Result<RhinoInference, RhinoError>

Gets inference results from Rhino. If the spoken command was understood, it includes the specific intent name that was inferred, and (if applicable) slot keys and specific slot values. Should only be called after the process function returns true, otherwise Rhino has not yet reached an inference conclusion.

Returns

  • Result<RhinoInference, RhinoError> : If Ok, a RhinoInference containing the inference result data. If Err, a RhinoError object describing the error that was encountered.

rhino::Rhino.context_info()

pub fn context_info(&self) -> String

Gets the context information.

Returns

  • String : Once initialized, stores the source of the Rhino context in YAML format. Shows the list of intents, which expressions map to those intents, as well as slots and their possible values.

rhino::Rhino.frame_length()

pub fn frame_length(&self) -> u32

Gets the frame length.

Returns

  • u32 : Number of audio samples per frame.

rhino::Rhino.sample_rate()

pub fn sample_rate(&self) -> u32

Gets the sample rate.

Returns

  • u32 : Audio sample rate accepted by Rhino.

rhino::Rhino.version()

pub fn version(&self) -> String

Gets the Rhino version.

Returns

  • String : Rhino version string.

rhino::RhinoBuilder

pub struct RhinoBuilder

Builder struct for creating an instance of Rhino.


rhino::RhinoBuilder::new()

pub fn new<S: Into<String>, P: Into<PathBuf>>(
access_key: S,
context_path: P
) -> Self

Creates a new RhinoBuilder from required arguments.

Parameters

  • access_key S : AccessKey obtained from Picovoice Console .
  • context_path P : Absolute path to the Rhino context file (.rhn).

Returns

  • RhinoBuilder : A new Builder object.

rhino::RhinoBuilder.access_key()

pub fn access_key<'a, S: Into<String>>(
&'a mut self,
access_key: S
) -> &'a mut Self

Modifies the access_key of a RhinoBuilder object.

Parameters

  • access_key S : AccessKey obtained from Picovoice Console .

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.library_path()

pub fn library_path<'a, P: Into<PathBuf>>(
&'a mut self,
library_path: P
) -> &'a mut Self

Overrides the default library_path of a RhinoBuilder object.

Parameters

  • library_path P : Path to the Rhino library file.

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.model_path()

pub fn model_path<'a, P: Into<PathBuf>>(
&'a mut self,
model_path: P
) -> &'a mut Self

Overrides the default model_path of a RhinoBuilder object.

Parameters

  • model_path P : Path to the file containing model parameters (.pv).

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.context_path()

pub fn context_path<'a, P: Into<PathBuf>>(
&'a mut self,
context_path: P
) -> &'a mut Self

Modifies the context_path of a RhinoBuilder object.

Parameters

  • context_path P : Absolute path to the Rhino context file (.rhn).

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.sensitivity()

pub fn sensitivity<'a>(&'a mut self, sensitivity: f32) -> &'a mut Self

Overrides the default sensitivity of a RhinoBuilder object.

Parameters

  • sensitivity f32 : Inference sensitivity. A higher sensitivity value results in fewer misses at the cost of (potentially) increasing the erroneous inference rate. Sensitivity should be a floating-point number within 0 and 1.

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.endpoint_duration_sec()

pub fn endpoint_duration_sec<'a>(&'a mut self, endpoint_duration_sec: f32) -> &'a mut Self

Overrides the default endpoint_duration_sec of a RhinoBuilder object.

Parameters

  • endpoint_duration_sec f32 : Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.require_endpoint()

pub fn require_endpoint<'a>(
&'a mut self,
require_endpoint: bool
) -> &'a mut Self

Overrides the default value of require_endpoint for a RhinoBuilder object.

Parameters

  • require_endpoint bool : If set to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false only if operating in an environment with overlapping speech (e.g. people talking in the background).

Returns

  • RhinoBuilder : The modified Builder object.

rhino::RhinoBuilder.init()

pub fn init(&self) -> Result<Rhino, RhinoError>

Creates an instance of Rhino from the RhinoBuilder object.

Returns

  • Result<Rhino, RhinoError> : If Ok, an initialized instance of Rhino. If Err, and instance of RhinoError detailing the error that was encountered.

rhino::RhinoInference

pub struct RhinoInference

Represents an inference result returned from the Speech-to-Intent engine.


rhino::RhinoInference.is_understood

pub is_understood: bool

Indicates whether Rhino understood what it processed based on the context.

rhino::RhinoInference.intent

pub intent: Option<String>

If is_understood, name of intent that was inferred.

rhino::RhinoInference.slots

pub slots: HashMap<String, String>

If is_understood, dictionary of slot keys and values that were inferred.


rhino::RhinoError

pub struct RhinoError

An error type describing any errors encountered by the Rhino SDK.


rhino::RhinoError.status

pub status: RhinoErrorStatus

Type of error encountered.


rhino::RhinoError.message

pub status: Option<String>

Message detailing the cause of the error.


rhino::RhinoError.new()

pub fn new(status: RhinoErrorStatus, message: &str) -> Self

Creates a new instance of RhinoError.

Parameters

  • status RhinoErrorStatus : Type of error encountered.
  • message &str : Message detailing the cause of the error.

rhino::RhinoErrorStatus

pub enum RhinoErrorStatus {
LibraryError(PvStatus),
LibraryLoadError,
FrameLengthError,
ArgumentError,
}

Enum describing possible error types returned from the Rhino Rust SDK.


rhino::PvStatus

pub enum PvStatus {
SUCCESS,
OUT_OF_MEMORY,
IO_ERROR,
INVALID_ARGUMENT,
STOP_ITERATION,
KEY_ERROR,
INVALID_STATE,
RUNTIME_ERROR,
ACTIVATION_ERROR,
ACTIVATION_LIMIT_REACHED,
ACTIVATION_THROTTLED,
ACTIVATION_REFUSED,
}

Error codes returned from the Rhino library.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Rhino Speech-to-Intent — Rust API
  • rhino::Rhino
  • process()
  • get_inference()
  • context_info()
  • frame_length()
  • sample_rate()
  • version()
  • rhino::RhinoBuilder
  • rhino::RhinoBuilder::new()
  • access_key()
  • library_path()
  • model_path()
  • context_path()
  • sensitivity()
  • endpoint_duration_sec()
  • require_endpoint()
  • init()
  • rhino::RhinoInference
  • is_understood
  • intent
  • slots
  • rhino::RhinoError
  • status
  • message
  • new()
  • rhino::RhinoErrorStatus
  • rhino::PvStatus
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.