python中除了英语之外的其他语言的语音识别

KCA*_*ril 4 python speech-recognition text-to-speech

我正在尝试将音频转换为文本。音频不是英语,而是荷兰语。我无法将荷兰语音频转换为文本。该代码仅适用于英语音频。我不确定是否需要为代码包含一些功能或选项来识别其他语言。下面是代码:

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)
Run Code Online (Sandbox Code Playgroud)

lui*_*igi 5

用:

text = r.recognize_google(audio, language="nl-NL")
Run Code Online (Sandbox Code Playgroud)