rhino/binding/python/__init__.py
Go to the documentation of this file.
1 #
2 # Copyright 2020-2022 Picovoice Inc.
3 #
4 # You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
5 # file accompanying this source.
6 #
7 # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8 # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9 # specific language governing permissions and limitations under the License.
10 #
11 
12 from .rhino import Rhino
13 from .rhino import RhinoError
14 from .rhino import RhinoMemoryError
15 from .rhino import RhinoIOError
16 from .rhino import RhinoInvalidArgumentError
17 from .rhino import RhinoStopIterationError
18 from .rhino import RhinoKeyError
19 from .rhino import RhinoInvalidStateError
20 from .rhino import RhinoRuntimeError
21 from .rhino import RhinoActivationError
22 from .rhino import RhinoActivationLimitError
23 from .rhino import RhinoActivationThrottledError
24 from .rhino import RhinoActivationRefusedError
25 from .util import *
26 
27 LIBRARY_PATH = pv_library_path('')
28 
29 MODEL_PATH = pv_model_path('')
30 
31 
32 def create(access_key, context_path, library_path=None, model_path=None, sensitivity=0.5, require_endpoint=True):
33  """
34  Factory method for Rhino Speech-to-Intent engine.
35 
36  :param access_key: AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
37  :param context_path: Absolute path to file containing context model (file with `.rhn` extension. A context
38  represents the set of expressions (spoken commands), intents, and intent arguments (slots) within a domain of
39  interest.
40  :param library_path: Absolute path to Rhino's dynamic library. If not set it will be set to the default
41  location.
42  :param model_path: Absolute path to the file containing model parameters. If not set it will be set to the default
43  location.
44  :param sensitivity: Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity value
45  results in fewer misses at the cost of (potentially) increasing the erroneous inference rate.
46  :param require_endpoint If set to `False`, Rhino does not require an endpoint (chunk of silence) before
47  finishing inference.
48  :return An instance of Rhino Speech-to-Intent engine.
49  """
50 
51  if library_path is None:
52  library_path = LIBRARY_PATH
53 
54  if model_path is None:
55  model_path = MODEL_PATH
56 
57  return Rhino(
58  access_key=access_key,
59  library_path=library_path,
60  model_path=model_path,
61  context_path=context_path,
62  sensitivity=sensitivity,
63  require_endpoint=require_endpoint)
python.util.pv_library_path
def pv_library_path(relative)
Definition: porcupine/binding/python/util.py:80
python.create
def create(access_key, library_path=None, model_path=None, keyword_paths=None, keywords=None, sensitivities=None)
Definition: porcupine/binding/python/__init__.py:36
python.util.pv_model_path
def pv_model_path(relative)
Definition: porcupine/binding/python/util.py:107


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:47