create static method
- String accessKey,
- String contextPath,
- InferenceCallback inferenceCallback, {
- String? modelPath,
- double sensitivity = 0.5,
- double endpointDurationSec = 1.0,
- bool requireEndpoint = true,
- ProcessErrorCallback? processErrorCallback,
Static creator for initializing Rhino
accessKey
AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
contextPath
Absolute path to the Rhino context file (.rhn).
inferenceCallback
A callback for when Rhino has made an intent inference
modelPath
(Optional) Path to the file containing model parameters.
If not set it will be set to the default location.
sensitivity
(Optional) 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.
endpointDurationSec
(Optional) 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
preemptively in case the user pauses before finishing the request.
requireEndpoint
(Optional) 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).
processErrorCallback
(Optional) Reports errors that are encountered while
the engine is processing audio.
Throws a RhinoException
if not initialized correctly
returns an instance of the speech-to-intent engine
Implementation
static Future<RhinoManager> create(
String accessKey, String contextPath, InferenceCallback inferenceCallback,
{String? modelPath,
double sensitivity = 0.5,
double endpointDurationSec = 1.0,
bool requireEndpoint = true,
ProcessErrorCallback? processErrorCallback}) async {
Rhino rhino = await Rhino.create(accessKey, contextPath,
modelPath: modelPath,
sensitivity: sensitivity,
endpointDurationSec: endpointDurationSec,
requireEndpoint: requireEndpoint);
return RhinoManager._(rhino, inferenceCallback, processErrorCallback);
}