Rhino Speech-to-Intent
.NET API
API Reference for the .NET Rhino SDK (NuGet)
namespace: Pv
Rhino
Class for the Rhino Speech-To-Intent engine.
Rhino.Create()
Rhino
constructor.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.contextPath
string : Absolute path to file containing context parameters (.rhn
).modelPath
string : Absolute path to the file containing model parameters (.pv
).sensitivity
float : Inference sensitivity. It should be a number within [0, 1].endpointDurationSec
float : 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.requireEndpoint
bool : If set totrue
, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set tofalse
, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set tofalse
only if operating in an environment with overlapping speech (e.g. people talking in the background).
Returns
Rhino
: An instance of Rhino Speech-To-Intent engine.
Throws
RhinoException
: If an error occurs while creating an instance of the Rhino Speech-To-Intent engine.
Rhino.Process()
Processes a frame of the incoming audio stream and emits the detection result. The number of samples per frame can be attained by calling .FrameLength
. The incoming audio needs to have a sample rate equal to .SampleRate
and be 16-bit linearly-encoded. Rhino operates on single-channel audio.
Parameters
pcm
short[] : A frame of audio samples.
Returns
bool
: Flag indicating whether the engine has finalized intent extraction.
Throws
RhinoException
: If there is an error while processing the audio frame.
Rhino.Reset()
Resets the internal state of Rhino
. It should be called before the engine can be used to infer intent from a new
stream of audio.
Throws
RhinoException
: If there is an error while resetting.
Rhino.GetInference()
Gets inference result. 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
RhinoInference
: The result of inference.
Throws
RhinoException
: If inference retrieval fails.
Rhino.ContextInfo
Getter for context information.
Returns
string
: Returns the context information.
Rhino.FrameLength
Getter for number of audio samples per frame.
Returns
int
: Number of audio samples per frame.
Rhino.SampleRate
Getter for audio sample rate accepted by Picovoice.
Returns
int
: Audio sample rate accepted by Picovoice.
Rhino.Version
Getter for version.
Returns
string
: CurrentRhino
version.
Inference
Class for holding Rhino inference result.
Inference.IsUnderstood
Getter for IsUnderstood.
Returns
bool
: Whether Rhino understood what it heard based on the context.
Inference.Intent
Getter for Intent.
Returns
string
: Name of intent that was inferred.
Inference.Slots
Getter for Slots.
Returns
Dictionary<string, string>
: Map of inference slots and values.
RhinoException
Exception thrown if an error occurs within the Rhino
engine.
Exceptions: