【发布时间】:2021-11-04 20:19:35
【问题描述】:
我正在尝试 Python(3.5 版)中的语音识别模块,但遇到以下错误:
'AttributeError: 'Recognizer' 对象没有属性'recognize''
这是我使用的代码:
import pyaudio
import speech_recognition as sr
r = sr.Recognizer()
r.energy_threshold=4000
with sr.Microphone() as source:
audio = r.listen(source)
try:
print("Speech was:" + r.recognize(audio))
except LookupError:
print('Speech not understood')
我在 Stack Overflow 本身上找到了这段代码,并从给定 here 的语音识别模块中阅读了文档,但是由于某种原因它没有在我的系统中执行。
【问题讨论】:
标签: python python-3.x