我正在尝试使 Uberi 识别语音(python)工作,但recognize_azure给了我错误。
import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
AZURE_SPEECH_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
with m as source: r.adjust_for_ambient_noise(source)
print("Say something!")
with m as source: audio = r.listen(source)
try:
print("Microsoft Azure Speech thinks you said " + r.recognize_azure(audio, key=AZURE_SPEECH_KEY))
except sr.UnknownValueError:
print("Microsoft Azure Speech could not understand audio")
except sr.RequestError as e:
print("Could not request results from Microsoft Azure Speech service; {0}".format(e))
这是结果:
AttributeError:'Recognizer' 对象没有属性'recognize_azure'
偶然的你
相关分类