Skip to main content

Python interface to CMU Sphinxbase and Pocketsphinx libraries

Project description

Latest Version Development Status Supported Python Versions Build Status License

Python interface to CMU Sphinxbase and Pocketsphinx libraries created with SWIG. Pocketsphinx packages include python support, however, it is based on Automake and not well supported on Windows. Pocketsphinx is part of the CMU Sphinx Open Source Toolkit For Speech Recognition.

This package provides module created with Python distutils setup and can be more portable.

Supported Platforms

  • Windows 7

  • Windows 8

  • Ubuntu 14.04

Install on Windows

Requirements

Install

# From pip
$ pip install pocketsphinx

# From source
$ git clone --recursive https://github.com/bambocher/pocketsphinx-python
$ cd pocketsphinx-python
$ python setup.py install

Install on Ubuntu

Requirements

  • python

  • python-dev

  • python-pip

  • build-essential

  • swig

  • git

Install

# From pip
$ sudo apt-get install -qq python python-dev python-pip build-essential swig
$ sudo pip install pocketsphinx

# From source
$ sudo apt-get install -qq python python-dev python-pip build-essential swig git
$ git clone --recursive https://github.com/bambocher/pocketsphinx-python
$ cd pocketsphinx-python
$ sudo python setup.py install

Basic usage

#!/usr/bin/env python
import os

import sphinxbase as sb
import pocketsphinx as ps

MODELDIR = 'deps/pocketsphinx/model'
DATADIR = 'deps/pocketsphinx/test/data'

# Create a decoder with certain model
config = ps.Decoder.default_config()
config.set_string('-hmm', os.path.join(MODELDIR, 'en-us/en-us'))
config.set_string('-lm', os.path.join(MODELDIR, 'en-us/en-us.lm.bin'))
config.set_string('-dict', os.path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
decoder = ps.Decoder(config)

# Decode streaming data.
decoder.start_utt()
stream = open(os.path.join(DATADIR, 'goforward.raw'), 'rb')
while True:
    buf = stream.read(1024)
    if buf:
        decoder.process_raw(buf, False, False)
    else:
        break
decoder.end_utt()
stream.close()
print('Best hypothesis segments:', [seg.word for seg in decoder.seg()])

Projects using pocketsphinx-python

  • SpeechRecognition - Library for performing speech recognition, with support for several engines and APIs, online and offline.

License

The BSD License

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

pocketsphinx-0.1.0.zip (723.4 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.tar.gz (503.4 kB view hashes)

Uploaded Source

Built Distributions

pocketsphinx-0.1.0.win-amd64-py3.5.msi (630.8 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win-amd64-py3.5.exe (677.3 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win-amd64-py2.7.msi (639.0 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win-amd64-py2.7.exe (716.5 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win32-py3.5.msi (499.7 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win32-py3.5.exe (539.5 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win32-py2.7.msi (540.7 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0.win32-py2.7.exe (591.3 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0-py3.5-win-amd64.egg (551.5 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0-py3.5-win32.egg (420.8 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0-py3.5-linux-x86_64.egg (1.4 MB view hashes)

Uploaded Source

pocketsphinx-0.1.0-py2.7-win-amd64.egg (502.2 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0-py2.7-win32.egg (404.6 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0-py2.7-linux-x86_64.egg (540.0 kB view hashes)

Uploaded Source

pocketsphinx-0.1.0-cp35-cp35m-win_amd64.whl (537.6 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

pocketsphinx-0.1.0-cp35-cp35m-win32.whl (407.0 kB view hashes)

Uploaded CPython 3.5m Windows x86

pocketsphinx-0.1.0-cp27-cp27m-win_amd64.whl (489.3 kB view hashes)

Uploaded CPython 2.7m Windows x86-64

pocketsphinx-0.1.0-cp27-cp27m-win32.whl (391.7 kB view hashes)

Uploaded CPython 2.7m Windows x86

Supported by

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