第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > python音频转文字speech recognition_使用SpeechRecognition进行语音识别

python音频转文字speech recognition_使用SpeechRecognition进行语音识别

时间:2018-10-31 09:57:55

相关推荐

python音频转文字speech recognition_使用SpeechRecognition进行语音识别

操作系统 : CentOS7.7.1908_x64

gcc版本 :4.8.5

Python 版本 : 3.6.8

安装语音识别环境:

virtualenv-p/usr/bin/python3py36asr

sourcepy36asr/bin/activate

pipinstallSpeechRecognition

yuminstallpython3-devel

yuminstallpulseaudio-libs-devel

yuminstallalsa-lib-devel

pipinstallPocketSphinx

配置中文语音识别数据:

下载地址:

/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/

选择: Mandarin->cmusphinx-zh-cn-5.2.tar.gz

配置数据:cdpy36asr/lib/python3.6/site-packages/speech_recognition/pocketsphinx-data/

tarzxvfcmusphinx-zh-cn-5.2.tar.gz

mvcmusphinx-zh-cn-5.2zh-cn

cdzh-cn

mvzh_cn.cd_cont_5000acoustic-model

mvzh_cn.lm.binlanguage-model.lm.bin

mvzh_cn.dicpronounciation-dictionary.dict

测试文本:

自然语言理解和生成是一个多方面问题,我们对它可能也只是部分理解。

语音识别示例:

(py36asr)[root@host60pyasrTest1]#ls

test1.pytest1.wav

(py36asr)[root@host60pyasrTest1]#cattest1.py

#-*-coding:utf-8-*-

#/usr/bin/python

importspeech_recognitionassr

r=sr.Recognizer()

test=sr.AudioFile("test1.wav")

withtestassource:

audio=r.record(source)

type(audio)

c=r.recognize_sphinx(audio,language='zh-cn')

print(c)

(py36asr)[root@host60pyasrTest1]#pythontest1.py

自然语言李杰和申城是一个多方面问题我们对他可能也只是部分礼节

(py36asr)[root@host60pyasrTest1]#

本文涉及资源下载地址:/s/1Out0tJlb_Qs-2C06_2YHOQ

可关注微信公众号(聊聊博文)后回复 01 获取提取码。

本文github地址:

/mike-zhang/mikeBlogEssays/blob/master//_使用SpeechRecognition进行语音识别.rst更多Python相关文章,请关注云海天python教程网。

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