1 Star 0 Fork 1

Yihui Xiong / pocketsphinx-python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

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()])

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/yihui/pocketsphinx-python.git
git@gitee.com:yihui/pocketsphinx-python.git
yihui
pocketsphinx-python
pocketsphinx-python
master

搜索帮助