Giter Site home page Giter Site logo

theja0473 / pocketsphinx-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bambocher/pocketsphinx-python

0.0 1.0 0.0 25.05 MB

Python interface to CMU SphinxBase and PocketSphinx libraries

Python 47.74% C 38.53% Batchfile 7.11% Shell 6.63%

pocketsphinx-python's Introduction

pocketsphinx-python

Build Status

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.

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

Supported Platforms

  • Windows 7
  • Windows 8
  • Ubuntu 14.10

Install on Windows

Dependencies

Install

pip install pocketsphinx

or

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

Install on Ubuntu

Dependencies

  • python
  • python-dev
  • python-pip
  • build-essential
  • swig
  • git

Install

sudo apt-get install -y python python-dev python-pip build-essential swig git
sudo pip install pocketsphinx

or

sudo apt-get install -y 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
from os import environ, path

from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *

MODELDIR = "pocketsphinx/model"
DATADIR = "pocketsphinx/test/data"

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

# Decode streaming data.
decoder = Decoder(config)
decoder.start_utt()
stream = open(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()
print ('Best hypothesis segments: ', [seg.word for seg in decoder.seg()])

pocketsphinx-python's People

Contributors

bambocher avatar nshmyrev avatar

Watchers

Thejeswarareddy R avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.