如何使用python进行语音识别

时间:2018-10-02 07:52:45

标签: python-3.x

我尝试过

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))

但是我没有得到它总是显示的预期输出,无法理解声音

1 个答案:

答案 0 :(得分:0)

我会检查一下: https://pypi.org/project/SpeechRecognition/

应该正是您需要的:-D