Classes | Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
python.rhino.Rhino Class Reference
Inheritance diagram for python.rhino.Rhino:
Inheritance graph
[legend]

Classes

class  CRhino
 
class  PicovoiceStatuses
 

Public Member Functions

def __init__ (self, access_key, library_path, model_path, context_path, sensitivity=0.5, require_endpoint=True)
 
def context_info (self)
 
def delete (self)
 
def frame_length (self)
 
def get_inference (self)
 
def process (self, pcm)
 
def sample_rate (self)
 
def version (self)
 

Static Public Attributes

 Inference = namedtuple('Inference', ['is_understood', 'intent', 'slots'])
 

Private Attributes

 _context_info
 
 _delete_func
 
 _frame_length
 
 _free_slots_and_values_func
 
 _get_intent_func
 
 _handle
 
 _is_understood_func
 
 _process_func
 
 _reset_func
 
 _sample_rate
 
 _version
 

Static Private Attributes

 __doc__
 
 _PICOVOICE_STATUS_TO_EXCEPTION
 

Detailed Description

Python binding for Rhino Speech-to-Intent engine. It directly infers the user's intent from spoken commands in
real-time. Rhino processes incoming audio in consecutive frames and indicates if the inference is finalized. When
finalized, the inferred intent can be retrieved as structured data in the form of an intent string and pairs of
slots and values. The number of samples per frame can be attained by calling `.frame_length`. The incoming audio
needs to have a sample rate equal to `.sample_rate` and be 16-bit linearly-encoded. Rhino operates on single-channel
audio.

Definition at line 66 of file rhino.py.

Constructor & Destructor Documentation

◆ __init__()

def python.rhino.Rhino.__init__ (   self,
  access_key,
  library_path,
  model_path,
  context_path,
  sensitivity = 0.5,
  require_endpoint = True 
)
Constructor.

:param access_key: AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
:param library_path: Absolute path to Rhino's dynamic library.
:param model_path: Absolute path to file containing model parameters.
:param context_path: Absolute path to file containing context parameters. A context represents the set of
expressions (spoken commands), intents, and intent arguments (slots) within a domain of interest.
:param sensitivity: Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity value
results in fewer misses at the cost of (potentially) increasing the erroneous inference rate.
:param require_endpoint If set to `False`, Rhino does not require an endpoint (chunk of silence) before
finishing inference.

Definition at line 116 of file rhino.py.

Member Function Documentation

◆ context_info()

def python.rhino.Rhino.context_info (   self)
Context information.

Definition at line 293 of file rhino.py.

◆ delete()

def python.rhino.Rhino.delete (   self)
Releases resources acquired.

Definition at line 219 of file rhino.py.

◆ frame_length()

def python.rhino.Rhino.frame_length (   self)
Number of audio samples per frame.

Definition at line 305 of file rhino.py.

◆ get_inference()

def python.rhino.Rhino.get_inference (   self)
 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.
 :return Inference object with `.is_understood`, `.intent` , and `.slots` getters.

Definition at line 245 of file rhino.py.

◆ process()

def python.rhino.Rhino.process (   self,
  pcm 
)
Processes a frame of audio and emits a flag indicating if the inference is finalized. When finalized,
`.get_inference()` should be called to retrieve the intent and slots, if the spoken command is considered valid.

:param pcm: A frame of audio samples. The number of samples per frame can be attained by calling
`.frame_length`. The incoming audio needs to have a sample rate equal to `.sample_rate` and be 16-bit
linearly-encoded. Rhino operates on single-channel audio.
:return: Flag indicating if the inference is finalized.

Definition at line 224 of file rhino.py.

◆ sample_rate()

def python.rhino.Rhino.sample_rate (   self)
Audio sample rate accepted by Picovoice.

Definition at line 311 of file rhino.py.

◆ version()

def python.rhino.Rhino.version (   self)
Version.

Definition at line 299 of file rhino.py.

Member Data Documentation

◆ __doc__

python.rhino.Rhino.__doc__
staticprivate

Definition at line 105 of file rhino.py.

◆ _context_info

python.rhino.Rhino._context_info
private

Definition at line 208 of file rhino.py.

◆ _delete_func

python.rhino.Rhino._delete_func
private

Definition at line 170 of file rhino.py.

◆ _frame_length

python.rhino.Rhino._frame_length
private

Definition at line 215 of file rhino.py.

◆ _free_slots_and_values_func

python.rhino.Rhino._free_slots_and_values_func
private

Definition at line 191 of file rhino.py.

◆ _get_intent_func

python.rhino.Rhino._get_intent_func
private

Definition at line 182 of file rhino.py.

◆ _handle

python.rhino.Rhino._handle
private

Definition at line 158 of file rhino.py.

◆ _is_understood_func

python.rhino.Rhino._is_understood_func
private

Definition at line 178 of file rhino.py.

◆ _PICOVOICE_STATUS_TO_EXCEPTION

python.rhino.Rhino._PICOVOICE_STATUS_TO_EXCEPTION
staticprivate

Definition at line 90 of file rhino.py.

◆ _process_func

python.rhino.Rhino._process_func
private

Definition at line 174 of file rhino.py.

◆ _reset_func

python.rhino.Rhino._reset_func
private

Definition at line 195 of file rhino.py.

◆ _sample_rate

python.rhino.Rhino._sample_rate
private

Definition at line 217 of file rhino.py.

◆ _version

python.rhino.Rhino._version
private

Definition at line 213 of file rhino.py.

◆ Inference

python.rhino.Rhino.Inference = namedtuple('Inference', ['is_understood', 'intent', 'slots'])
static

Definition at line 104 of file rhino.py.


The documentation for this class was generated from the following file:


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:20