Official Python bindings for PocketSphinx
Maintained. Last release 6 months ago, commits in 6 of the last 26 weeks.
pip install pocketsphinxPocketSphinx 5.1.1
This is PocketSphinx, one of Carnegie Mellon University's open source large vocabulary, speaker-independent continuous speech recognition engines.
Although this was at one point a research system, active development has largely ceased and it has become very, very far from the state of the art. I am making a release, because people are nonetheless using it, and there are a number of historical errors in the build system and API which needed to be corrected.
The version number is strangely large because there was a "release" that people are using called 5prealpha, and we will use proper semantic versioning from now on.
Please see the LICENSE file for terms of use.
Installation
You should be able to install this with pip for recent platforms and versions of Python:
pip3 install pocketsphinx
Alternately, you can also compile it from the source tree. I highly
suggest doing this in a virtual environment (replace
~/ve_pocketsphinx with the virtual environment you wish to create),
from the top level directory:
python3 -m venv ~/ve_pocketsphinx
. ~/ve_pocketsphinx/bin/activate
pip3 install .
On GNU/Linux and maybe other platforms, you must have
PortAudio installed for the LiveSpeech
class to work (we may add a fall-back to sox in the near future).
On Debian-like systems this can be achieved by installing the
libportaudio2 package:
sudo apt-get install libportaudio2
Usage
See the examples directory for a number of examples of using the library from Python. You can also read the documentation for the Python API or the C API.
It also mostly supports the same APIs as the previous pocketsphinx-python module, as described below.
LiveSpeech
An iterator class for continuous recognition or keyword search from a microphone. For example, to do speech-to-text with the default (some kind of US English) model:
from pocketsphinx import LiveSpeech
for phrase in LiveSpeech(): print(phrase)