我只是按照这个>> 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.
答案 0 :(得分:0)
您需要pip install PocketSphinx
,这取决于二进制SWIG包。对于Windows,SWIG说明位于this SO answer。
对于OSX,还有其他要求:
$ brew install cmu-pocketsphinx
$ brew install portaudio
$ brew install swig
$ pip install PocketSphinx