【发布时间】:2021-03-06 15:42:24
【问题描述】:
我的问题
我正在使用 python speech recognition library by Uberi 将.wav 音频文件转录为纯文本。但是,当我使用 Google Speech Recognition 运行我的代码时,我收到了 RequestError。
对于这个(特定的)错误,我在语音识别 GitHub 上找到了 Opened Issue,但没有任何答案。
我该如何解决这个问题?我知道我可以尝试使用不同的引擎来代替 Google;但是看起来他们都需要密钥,我希望在没有密钥的情况下转录我的文件。
我的代码
import speech_recognition as sr
clip = "MyFile.wav"
#Initialize recognizer class (for recognizing the speech)
r = sr.Recognizer()
# Reading Audio file as source
# listening the audio file and store in audio_text variable
with sr.AudioFile(clip) as source:
audio_text = r.record(source)
text = r.recognize_google(audio_text)
print(text)
错误
speech_recognition.RequestError: recognition request failed: Bad Request
一个想法
一个可能的原因可能是我的 .wav 的大小(~ 1 GB)。稍后我将尝试使用一个小的 .wav 运行我的代码来检查。
【问题讨论】:
标签: python speech-recognition urllib google-speech-api google-speech-to-text-api