Python音频转文字

import speech_recognition as sr
file ="test.wav"
r= sr.Recognizer()
with sr.AudioFile(file) as src:
    audio = r.record(src)
print("音声データの文字をお越し結果:", r.recognize_google(audio,language="ja"))

speech_recognition:https://github.com/Uberi/speech_recognition
在这里插入图片描述

import speech_recognition as sr

file ="tianqi.wav"

r= sr.Recognizer()

with sr.AudioFile(file) as src:
    audio = r.record(src)

print("识别結果:", r.recognize_google(audio,language="zh-tw"))
print("识别結果:", r.recognize_google(audio,language="zh-cn"))

在这里插入图片描述
说明,需要使用代理,需要连接网络。

你可能感兴趣的:(python,音频转文字)