语音识别测试:NameError: name 'recognize_google' is not defined
import speech_recognition as srr = sr.Recognizer()
with sr.Microphone() as source:
print('Say Something')
audio = r.listen(source)
voice_data = recognize_google(audio)
print(voice_data)
###############################################
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\b编程\xx-test\310录音识别播放1.py", line 8, in <module>
voice_data = recognize_google(audio)
NameError: name 'recognize_google' is not defined import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print('Say Something')
audio = r.listen(source)
voice_data = r.recognize_google(audio) # 这一行少了 r.
print(voice_data)
页:
[1]