python - 为什么即使代码正确,我的语音识别程序也无法工作?
问题描述
我正在尝试用 python 制作我自己的助手,比如谷歌助手。我的语音识别程序以前可以工作,但是从计算机中清除了一些垃圾文件后它无法正常工作,它卡在“Speak:”上并且没有将语音转换为文本,甚至没有显示任何错误。
我已经安装了pyaudio,speechrecognition。
这是代码:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print("Speak:")
audio = r.listen(source)
try:
print("You said " + r.recognize_google(audio))
except sr.UnknownValueError:
print("Could not understand audio")
except sr.RequestError as e:
print("Could not request results; {0}".format(e))
解决方案
推荐阅读
- matlab - 根据两列中的元素从另一个数组中减去一个数组
- javascript - 如何跳转到 JSON 对象中特定键的值?
- sql - SQL BigQuery 聚合取决于条件
- javascript - JavaScript 正在减慢 HTML 渲染速度
- python - 如何使用 Python 找到 FFT 图的峰值?
- python-3.x - 如何在我的 venv 本地运行 App Platform 的 Flask 应用程序?
- android - 在 Play 商店中部署并安装时启动画面卡住
- flutter - 在导航器颤动中传递参数
- firebase - React Native:尝试创建新用户时出现firebase auth / network-request-failed错误,但登录时没有?
- api - Rest API 应该再次验证传入的请求吗?