Python音訊轉文字

佐倉發表於2021-01-02
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"))

在這裡插入圖片描述
說明,需要使用代理,需要連線網路。

相關文章