2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > python音频转文字speech recognition_演示如何使用SpeechRecognition转录音频文件

python音频转文字speech recognition_演示如何使用SpeechRecognition转录音频文件

时间:2023-04-17 11:28:18

相关推荐

python音频转文字speech recognition_演示如何使用SpeechRecognition转录音频文件

我最近试图学习如何转录音频文件,但我对python不太熟悉。在

我从下面的网站上读到了SpeechRecognition的例子

我尝试使用以下代码来使用它们:

但是,看起来我无法在windows计算机中导入我的文件。在

我想知道我的电脑里是否有一个带有路径的wav文件

“C:\Users\Chen\Downloads\英语.wav““

我试图用python代码中的“C:\Users\Chen\Downloads”替换文件。在

但它告诉我

FileNotFoundError:[Errno 2]没有这样的文件或目录:'C:\Users\Chen\英语.wav'

请帮我解决这些问题。在import speech_recognition as sr

# obtain path to "english.wav" in the same folder as this script

from os import path

AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav")

# use the audio file as the audio source

r = sr.Recognizer()

with sr.AudioFile(AUDIO_FILE) as source:

audio = r.record(source) # read the entire audio file

print("Google Speech Recognition thinks you said " + r.recognize_google(audio))

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。