Skip to main content

Kaldi speech recognition with grammars that can be set active/inactive dynamically at decode-time

Project description

Kaldi Active Grammar

Python Kaldi speech recognition with grammars that can be set active/inactive dynamically at decode-time

PyPI - Status PyPI - Version PyPI - Python Version PyPI - Wheel PyPI - Downloads Donate

Python package developed to enable context-based command & control of computer applications, as in the Dragonfly speech recognition framework, using the Kaldi automatic speech recognition engine.

BETA RELEASE

Normally, Kaldi decoding graphs are monolithic, require expensive up-front off-line compilation, and are static during decoding. Kaldi's new grammar framework allows multiple independent grammars with nonterminals, to be compiled separately and stitched together dynamically at decode-time, but all the grammars are always active and capable of being recognized.

This project extends that to allow each grammar/rule to be independently marked as active/inactive dynamically on a per-utterance basis (set at the beginning of each utterance). Dragonfly is then capable of activating only the appropriate grammars for the current environment, resulting in increased accuracy due to fewer possible recognitions. Furthermore, the dictation grammar can be shared between all the command grammars, which can be compiled quickly without needing to include large-vocabulary dictation directly.

Donations are appreciated to encourage development.

Setup

Requirements:

  • Python 2.7 (3.x support planned); 64-bit required!
    • Microphone support provided by pyaudio package
  • OS: Linux or Windows; macOS planned if there is interest
  • Only supports Kaldi left-biphone models, specifically nnet3 chain models

Install Python package, which includes necessary Kaldi binaries:

pip install kaldi-active-grammar

Download compatible generic English Kaldi nnet3 chain model from project releases. Unzip the model and pass the directory path to kaldi-active-grammar constructor.

Or use your own model. Standard Kaldi models must be converted to be usable. Conversion can be performed automatically, but this hasn't been fully implemented yet.

Troubleshooting

  • Errors installing
    • Make sure you are using a 64-bit Python.
    • Update your pip by executing pip install --upgrade pip.

Contributing

Please feel free to submit issues, suggestions, and feature requests. Pull requests are considered, but project structure is in flux.

Donations are appreciated to encourage development.

Donate

Author

License

This project is licensed under the GNU Affero General Public License v3 (AGPL-3.0), with the exception of the associated binaries, whose source is currently unreleased and which are only to be used by this project. See the LICENSE.txt file for details.

If this license is problematic for you, please contact me.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kaldi_active_grammar-0.3.0-py2.py3-none-win_amd64.whl (17.2 MB view details)

Uploaded Python 2Python 3Windows x86-64

kaldi_active_grammar-0.3.0-py2.py3-none-manylinux2010_x86_64.whl (21.4 MB view details)

Uploaded Python 2Python 3manylinux: glibc 2.12+ x86-64

File details

Details for the file kaldi_active_grammar-0.3.0-py2.py3-none-win_amd64.whl.

File metadata

  • Download URL: kaldi_active_grammar-0.3.0-py2.py3-none-win_amd64.whl
  • Upload date:
  • Size: 17.2 MB
  • Tags: Python 2, Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

File hashes

Hashes for kaldi_active_grammar-0.3.0-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7c0e8098e231a18aadad33064401ac4c70e2eac6a876962305b019c93ee42c78
MD5 9ad1343767572b41d1bc8866b3ee22c0
BLAKE2b-256 6d52c9c0972ec90a410eff82137c7212b2a0dd7f6a2e031fb6232177cdcc444d

See more details on using hashes here.

File details

Details for the file kaldi_active_grammar-0.3.0-py2.py3-none-manylinux2010_x86_64.whl.

File metadata

  • Download URL: kaldi_active_grammar-0.3.0-py2.py3-none-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 21.4 MB
  • Tags: Python 2, Python 3, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/2.7.13

File hashes

Hashes for kaldi_active_grammar-0.3.0-py2.py3-none-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 db409840eaa46610142dee17bda70a2a20344ff34ee868b50b39e315bcadb5c9
MD5 242c8f0225f428065b79140484ce04fb
BLAKE2b-256 fe180816cc9b482316f35bd3ea7447d66cf189ba59df03bf46e127eab8611988

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page