How to change the language of Google speech recognition

23,891

here's the relevant line of documentataion.

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

Share:
23,891

Related videos on Youtube

Sudar
Author by

Sudar

Me: I'm 13. My hobbies are watching anime, reading, coing, drawing, gaming, and sports. Coding: I started coding a few months about and i love it. I like it. it let's me create new things. And i just like coding. Currently I code in Python and I am learn Javascript.

Updated on April 22, 2020

Comments

  • Sudar
    Sudar about 4 years

    My code:

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

    I would like to change the listening language to french. How should i do that?

  • Naazneen Jatu
    Naazneen Jatu about 4 years
    You can find all the possible language codes here : cloud.google.com/speech-to-text/docs/languages