微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

语音识别不适用于Google识别器和Python中的其他识别器吗?

如何解决语音识别不适用于Google识别器和Python中的其他识别器吗?

在“我的电脑”中,语音识别无法正常工作

import speech_recognition as sr
import pyttsx3
def speak(txt):
    Engine=pyttsx3.init()
    Engine.say(txt)
    Engine.runAndWait()
def takeCommand(): 
      
    r = sr.Recognizer() 
      
    with sr.Microphone() as source: 
          
        print("Listening...") 
        r.pause_threshold = 1
        audio = r.listen(source)
    try: 
        print("Recognizing...")     
        query = r.recognize_google(audio,language ='en-in') 
        print(f"User said: {query}\n") 
    except Exception as e: 
        print(e)     
        print("Unable to Recognizing your voice.")   
        return "None"
    return query
while True:
    query=takeCommand()
    speak(f"You said {(query)}")

它总是说“ NONE”(按我编程的那样),并打印“无法识别您的声音”,但没有错误。我删除try之后,它什么也没显示。 那么问题在哪里,如何解决。 预先感谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。