Rhino Speech-to-Intent
Go API
API Reference for the Rhino Go SDK (pkg.go.dev).
rhino.FrameLength
Number of audio samples per frame.
rhino.SampleRate
Audio sample rate accepted by Rhino.
rhino.Version
Rhino version.
rhino.PvStatus
Status return codes from the Rhino library. Possible values are:
rhino.NewRhino()
Creates a Rhino struct with default parameters, and the given context file.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).contextPath
string : Absolute path to the Rhino context file (.rhn).
Returns
Rhino
: An instance of Rhino struct.
rhino.Rhino
Struct for the Rhino Speech-to-Intent engine.
rhino.Rhino.AccessKey
AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
rhino.Rhino.ContextInfo
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.ContextPath
Absolute path to the Rhino context file (.rhn).
rhino.Rhino.LibraryPath
Absolute path to the Rhino's dynamic library.
rhino.Rhino.ModelPath
Absolute path to the file containing model parameters.
rhino.Rhino.RequireEndpoint
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).
rhino.Rhino.EndpointDurationSec
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.
rhino.Rhino.Sensitivity
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.
rhino.Rhino.Delete()
Releases resources acquired by Rhino.
Returns
error
: Error produced by the Rhino SDK.nil
if no error was encountered.
rhino.Rhino.GetInference()
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
RhinoInference
: Inference result.error
: Error produced by the Rhino SDK.nil
if no error was encountered.
rhino.Rhino.Init()
Init function for Rhino. Must be called before attempting process.
Returns
error
: Error produced by the Rhino SDK.nil
if no error was encountered.
rhino.Rhino.Process()
Process a frame of pcm audio with the speech-to-intent engine.
Parameters
pcm
[]int16 : A frame of audio samples.
Returns
bool
: Indicates whether Rhino has an inference ready or not.error
: Error produced by the Rhino SDK.nil
if no error was encountered.
rhino.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.
Returns
error
: Error produced by the Rhino.nil
if no error was encountered.
rhino.RhinoError
Custom error type for errors produced from the Rhino Go SDK.
rhino.RhinoError.Error()
Formats the Rhino error into a string.
Returns
string
: Formatted error string.
rhino.RhinoInference
A struct containing Rhino inference result data.
rhino.RhinoInference.IsUnderstood
Indicates whether Rhino understood what it heard based on the context.
rhino.RhinoInference.Intent
If IsUnderstood, name of intent that was inferred.
rhino.RhinoInference.Slots
If IsUnderstood, dictionary of slot keys and values that were inferred.