【问题标题】:speech recognition python3.4 with pocketsphinx带有pocketsphinx的语音识别python3.4
【发布时间】:2017-07-15 14:51:15
【问题描述】:

我只是关注这个>>steps

现在,我该如何开始使用 python? 我试过这段代码:

import speech_recognition as sr

# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
    print("Say something!")
    audio = r.listen(source)

# recognize speech using Sphinx
try:
    print("Sphinx thinks you said " + r.recognize_sphinx(audio))
except sr.UnknownValueError:
    print("Sphinx could not understand audio")
except sr.RequestError as e:
    print("Sphinx error; {0}".format(e))

得到一个错误:

Sphinx error; missing PocketSphinx module: ensure that PocketSphinx is set up correctly.

speech_recognition 已经安装,但我不确定 pocketsphinx 和 sphinxbase。我所做的一切都遵循:https://cmusphinx.github.io/wiki/tutorialpocketsphinx/

【问题讨论】:

  • 它说“要求已经满足:c:\python34\lib\site-packages 中的 pocketsphinx”,或者我在哪里可以找到 pocketsphinx 包?,我在 windows 上运行
  • 您很可能在为 python3 安装 pocketsphinx 时尝试使用 python2 运行 Speech_recognition。你需要确保你只有一个 python 版本。
  • 我确定它是在 python3 上运行并为 python3 安装的,当我安装 pocketsphinx 时出现了一些问题,我需要一个叫做 swig 的东西来通过 pip 安装 pocketsphinx,我怎样才能得到那个 swig?
  • swig 在swig.org上可用

标签: speech-recognition python-3.4 pocketsphinx


【解决方案1】:

您需要pip install PocketSphinx,这取决于二进制 SWIG 包。对于 Windows,SWIG 说明位于 this SO answer

对于 OSX 有额外的要求:

$ brew install cmu-pocketsphinx
$ brew install portaudio
$ brew install swig
$ pip install PocketSphinx

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多