【问题标题】:How to change the language of Google speech recognition如何更改谷歌语音识别的语言
【发布时间】:2018-04-09 12:03:41
【问题描述】:

我的代码:

with sr.Microphone() as source:
    audio = r.listen(source)
    try:
        print("You said: " + r.recognize_google(audio) + "in french")
    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service")

我想将听力语言更改为法语。我该怎么做?

【问题讨论】:

    标签: python python-3.x speech-recognition google-speech-api french


    【解决方案1】:

    这里是the relevant line of documentataion.

    试试r.recognize_google(audio, language="fr-FR")

    【讨论】:

    【解决方案2】:
    try:
        voise = r.recognize_google(audio, language="fr-FR")
    except sr.UnknownValueError:
        speak('understand')
    return voise
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多