gpt4 book ai didi

speech-recognition - 带有pocketsphinx的语音识别python3.4

转载 作者:行者123 更新时间:2023-12-03 23:40:53 24 4
gpt4 key购买 nike

我只关注这个>> 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.
语音识别已经安装,但我不确定pocketsphinx 和sphinxbase。我所做的一切: https://cmusphinx.github.io/wiki/tutorialpocketsphinx/

最佳答案

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

对于 OSX,还有其他要求:

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

关于speech-recognition - 带有pocketsphinx的语音识别python3.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45119484/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com