pvoctopus


Namepvoctopus JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/Picovoice/octopus
SummaryOctopus Speech-to-Index engine.
upload_time2022-08-05 23:18:27
maintainer
docs_urlNone
authorPicovoice
requires_python>=3.5
license
keywords speech-to-index voice search keyword spotting speech recognition voice recognition
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Octopus

Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)

Octopus is Picovoice's Speech-to-Index engine. It directly indexes speech without relying on a text representation. This
acoustic-only approach boosts accuracy by removing out-of-vocabulary limitation and eliminating the problem of competing
hypothesis (e.g. homophones)

## Compatibility

- Python 3.5+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)

## Installation

```console
pip3 install pvoctopus
```

## AccessKey

Octopus requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Octopus SDKs.
You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.

## Usage

Create an instance of the engine:

```python
import pvoctopus

access_key = ""  # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
handle = pvoctopus.create(access_key=access_key)
```

Octopus consists of two steps: Indexing and Searching. Indexing transforms audio data into a `Metadata` object that
searches can be run against.

Octopus indexing has two modes of operation: indexing PCM audio data, or indexing an audio file.

When indexing PCM audio data, the valid audio sample rate is given by `handle.sample_rate`.
The engine accepts 16-bit linearly-encoded PCM and operates on single-channel audio:

```python
audio_data = [...]
metadata = handle.index(audio_data)
```

Similarly, files can be indexed by passing in the absolute file path to the audio object.
Supported file formats are mp3, flac, wav and opus:

```python
audio_file_path = "/path/to/my/audiofile.wav"
metadata = handle.index_file(audio_file_path)
```

Once the `Metadata` object has been created, it can be used for searching:

```python
search_term = 'picovoice'
matches = octopus.search(metadata, [search_term])
```

Multiple search terms can be given:
```python
matches = octopus.search(metadata, ['picovoice', 'Octopus', 'rhino'])
```

The `matches` object is a dictionary where the `key` is the `phrase`, and the `value` is a `list` of `Match` objects.
The `Match` object contains the `start_sec`, `end_sec` and `probablity` of each match:

```python
matches = octopus.search(metadata, ['avocado'])

avocado_matches = matches['avocado']
for match in avocado_matches:
    print(f"Match for `avocado`: {match.start_sec} -> {match.end_sec} ({match.probablity})")
```

The `Metadata` object can be cached or stored to skip the indexing step on subsequent searches.
This can be done with the `to_bytes()` and `from_bytes()` methods:

```python
metadata_bytes = metadata.to_bytes()

# ... Write & load `metadata_bytes` from cache/filesystem/etc.

cached_metadata = pvoctopus.OctopusMetadata.from_bytes(metadata_bytes)
matches = octopus.search(cached_metadata, ['avocado'])
```

When done the handle resources have to be released explicitly:

```python
handle.delete()
```

## Non-English Models

In order to search non-English phrases you need to use the corresponding model file. The model files for all supported
languages are available [here](https://github.com/Picovoice/octopus/tree/main/lib/common/param).

## Demos

[pvoctopusdemo](https://pypi.org/project/pvoctopusdemo/) provides command-line utilities for searching audio files using
Octopus.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Picovoice/octopus",
    "name": "pvoctopus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "Speech-to-Index,Voice Search,Keyword Spotting,Speech Recognition,Voice Recognition",
    "author": "Picovoice",
    "author_email": "hello@picovoice.ai",
    "download_url": "https://files.pythonhosted.org/packages/4e/d0/0fd0d600cc5fc90e67e4b946880a9eb48489e9fb8ceff0c3f4ffa2c948e4/pvoctopus-1.2.1.tar.gz",
    "platform": null,
    "description": "# Octopus\n\nMade in Vancouver, Canada by [Picovoice](https://picovoice.ai)\n\nOctopus is Picovoice's Speech-to-Index engine. It directly indexes speech without relying on a text representation. This\nacoustic-only approach boosts accuracy by removing out-of-vocabulary limitation and eliminating the problem of competing\nhypothesis (e.g. homophones)\n\n## Compatibility\n\n- Python 3.5+\n- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)\n\n## Installation\n\n```console\npip3 install pvoctopus\n```\n\n## AccessKey\n\nOctopus requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Octopus SDKs.\nYou can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.\nSignup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.\n\n## Usage\n\nCreate an instance of the engine:\n\n```python\nimport pvoctopus\n\naccess_key = \"\"  # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)\nhandle = pvoctopus.create(access_key=access_key)\n```\n\nOctopus consists of two steps: Indexing and Searching. Indexing transforms audio data into a `Metadata` object that\nsearches can be run against.\n\nOctopus indexing has two modes of operation: indexing PCM audio data, or indexing an audio file.\n\nWhen indexing PCM audio data, the valid audio sample rate is given by `handle.sample_rate`.\nThe engine accepts 16-bit linearly-encoded PCM and operates on single-channel audio:\n\n```python\naudio_data = [...]\nmetadata = handle.index(audio_data)\n```\n\nSimilarly, files can be indexed by passing in the absolute file path to the audio object.\nSupported file formats are mp3, flac, wav and opus:\n\n```python\naudio_file_path = \"/path/to/my/audiofile.wav\"\nmetadata = handle.index_file(audio_file_path)\n```\n\nOnce the `Metadata` object has been created, it can be used for searching:\n\n```python\nsearch_term = 'picovoice'\nmatches = octopus.search(metadata, [search_term])\n```\n\nMultiple search terms can be given:\n```python\nmatches = octopus.search(metadata, ['picovoice', 'Octopus', 'rhino'])\n```\n\nThe `matches` object is a dictionary where the `key` is the `phrase`, and the `value` is a `list` of `Match` objects.\nThe `Match` object contains the `start_sec`, `end_sec` and `probablity` of each match:\n\n```python\nmatches = octopus.search(metadata, ['avocado'])\n\navocado_matches = matches['avocado']\nfor match in avocado_matches:\n    print(f\"Match for `avocado`: {match.start_sec} -> {match.end_sec} ({match.probablity})\")\n```\n\nThe `Metadata` object can be cached or stored to skip the indexing step on subsequent searches.\nThis can be done with the `to_bytes()` and `from_bytes()` methods:\n\n```python\nmetadata_bytes = metadata.to_bytes()\n\n# ... Write & load `metadata_bytes` from cache/filesystem/etc.\n\ncached_metadata = pvoctopus.OctopusMetadata.from_bytes(metadata_bytes)\nmatches = octopus.search(cached_metadata, ['avocado'])\n```\n\nWhen done the handle resources have to be released explicitly:\n\n```python\nhandle.delete()\n```\n\n## Non-English Models\n\nIn order to search non-English phrases you need to use the corresponding model file. The model files for all supported\nlanguages are available [here](https://github.com/Picovoice/octopus/tree/main/lib/common/param).\n\n## Demos\n\n[pvoctopusdemo](https://pypi.org/project/pvoctopusdemo/) provides command-line utilities for searching audio files using\nOctopus.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Octopus Speech-to-Index engine.",
    "version": "1.2.1",
    "split_keywords": [
        "speech-to-index",
        "voice search",
        "keyword spotting",
        "speech recognition",
        "voice recognition"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e57104fe8d6f3125e96c63f2ef3a35e8",
                "sha256": "2572cf15083f885827f9cba567015f27c5ff26782255078e5b7d595713d9dd9b"
            },
            "downloads": -1,
            "filename": "pvoctopus-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e57104fe8d6f3125e96c63f2ef3a35e8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 8140202,
            "upload_time": "2022-08-05T23:18:23",
            "upload_time_iso_8601": "2022-08-05T23:18:23.704575Z",
            "url": "https://files.pythonhosted.org/packages/41/81/7224e9b853094d451893c641989454e395c5b1db5813f9c3863575431286/pvoctopus-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "db900c58be31ef74ff2b68d94e0ec6c4",
                "sha256": "a8788c1359e14bac49794ef8e33ab5b93a6908c58dc70b070bf5966d8227cc94"
            },
            "downloads": -1,
            "filename": "pvoctopus-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "db900c58be31ef74ff2b68d94e0ec6c4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 8141161,
            "upload_time": "2022-08-05T23:18:27",
            "upload_time_iso_8601": "2022-08-05T23:18:27.229997Z",
            "url": "https://files.pythonhosted.org/packages/4e/d0/0fd0d600cc5fc90e67e4b946880a9eb48489e9fb8ceff0c3f4ffa2c948e4/pvoctopus-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-05 23:18:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Picovoice",
    "github_project": "octopus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pvoctopus"
}
        
Elapsed time: 0.56640s