语音识别Python 2.7中没有响应

时间:2017-03-30 20:04:11

标签: python python-2.7 speech-recognition

我在Windows的Python 2.7上安装了语音识别模块和pyaudio。当我执行python脚本时,它执行没有错误,但程序仍然静止从用户收听,但没有给出任何响应,即程序没有“监听”。 希望你们能在这里帮助我! (新手!)

import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:                # use the default microphone as the audio source
    audio = r.listen(source)                   # listen for the first phrase and extract it into audio data

try:
    print("You said " + r.recognize(audio))    # recognize speech using Google Speech Recognition
except LookupError:                            # speech is unintelligible
    print("Could not understand audio")

0 个答案:

没有答案