Octopus Speech-to-Index
Python API
API Reference for the Python Octopus SDK (PyPI).
pvoctopus.create()
Factory method for Octopus Speech-to-Index engine.
Parameters
access_key
str : AccessKey obtained from Picovoice Console.model_path
Optional[str] : Absolute path to the file containing model parameters.library_path
Optional[str] : Absolute path to Octopus's dynamic library.
Returns
Octopus
: An instance of Octopus Speech-to-Index engine.
Throws
pvoctopus.Octopus
Class for the Octopus Speech-to-Index engine.
Octopus can be initialized either using the module level create()
function
or directly using the class __init__()
method.
Resources should be cleaned when you are done using the delete()
method.
pvoctopus.Octopus.Match
The type representing a matched search result.
pvoctopus.Octopus.version
The version string of the Octopus library.
pvoctopus.Octopus.sample_rate
Audio sample rate accepted by Octopus when processing PCM audio data.
pvoctopus.Octopus.__init__()
__init__
method for Octopus Speech-to-Index engine.
Parameters
access_key
str : AccessKey obtained from Picovoice Console.model_path
str : Absolute path to the file containing model parameters.library_path
str : Absolute path to Octopus's dynamic library.
Returns
Octopus
: An instance of Octopus Speech-to-Index engine.
Throws
pvoctopus.Octopus.delete()
Releases resources acquired by Octopus.
pvoctopus.Octopus.index_audio_data()
Indexes audio data. The audio needs to have a sample rate equal to .sample_rate
and be 16-bit linearly-encoded. This function operates on single-channel audio.
If you wish to process data in a different sample rate or format consider using .index_audio_file()
.
Parameters
pcm
Sequence[int] : Audio data.
Returns
OctopusMetadata
: An immutable metadata object.
Throws
pvoctopus.Octopus.index_audio_file()
Indexes audio file.
Parameters
audio_path
str : Absolute path to the audio file.
Returns
OctopusMetadata
: An immutable metadata object.
Throws
pvoctopus.Octopus.search()
Searches metadata for occurrences of a given phrase.
Parameters
metadata
OctopusMetadata : Metadata object.phrases
Iterable[str] : An iterable of phrases to search the index for.
Returns
Dict[str, Sequence[
Match
]]
: A dictionary map of found matches.
Throws
pvoctopus.OctopusMetadata
Python representation of the metadata object.
pvoctopus.OctopusError
Error thrown if an error occurs within Octopus
Speech-to-Index engine.
Exceptions