KApril
KApril

Reputation: 690

Speech recognization other languages apart from English in python

I am trying to convert audio to text. The audio is not in English but in Dutch. I am unable to convert the Dutch audio to text. The code works only for English audios. I am not sure if I need to include some functions or options for the code to recognise other languages as well. Below is the code:

import speech_recognition as sr

r = sr.Recognizer()

with sr.AudioFile('audio.wav') as source:
    audio = r.listen(source)
    try:
        text = (r.recognize_google)
        print(text)

Upvotes: 5

Views: 5246

Answers (2)

george wittken
george wittken

Reputation: 1

you can do any language you just need to know what is your countries domains like for instance German would be: de-DE

Upvotes: 0

luigigi
luigigi

Reputation: 4215

Use:

text = r.recognize_google(audio, language="nl-NL")

Upvotes: 5

Related Questions