0

这是脚本的一部分,这一切都搞砸了

def MyCommand():
    #init recongnize voice
    r = sr.Recongnize()
    r.pause_thershold = 3
    #threshold = one second, waiting to adjust threshold dependent on noise levels
    r.adjust_for_ambient_noise(source, duraiton=3)
    audio = r.listen(source)

try:
    command = r.recognize_google(audio).lower()
    print('you said:' + command + '\n')


    #loopback to continue to listen for commands if unrecognized speech is received
    except sr.UnknownValueError:
        print('I did not hear that')
        command = myCommand();

return command

while True:
    assistant(myCommand())

else:
    error = random.choice(error)
    talk(error)

为什么它不让我把它放进去,我尝试删除并重新安装 SR 模块但我没有运气。我试图在网上找到一些东西,但没有太多关于究竟是什么破坏了它的信息,我发现的大多数东西都是实际 SR 模块的问题。

4

0 回答 0