新聞中心
操作系統(tǒng) : CentOS7.7.1908_x64

超過10多年行業(yè)經(jīng)驗,技術(shù)領(lǐng)先,服務至上的經(jīng)營模式,全靠網(wǎng)絡(luò)和口碑獲得客戶,為自己降低成本,也就是為客戶降低成本。到目前業(yè)務范圍包括了:網(wǎng)站建設(shè)、網(wǎng)站制作,成都網(wǎng)站推廣,成都網(wǎng)站優(yōu)化,整體網(wǎng)絡(luò)托管,小程序制作,微信開發(fā),手機APP定制開發(fā),同時也可以讓客戶的網(wǎng)站和網(wǎng)絡(luò)營銷和我們一樣獲得訂單和生意!
gcc版本 :4.8.5
Python 版本 : 3.6.8
安裝語音識別環(huán)境:
virtualenv -p /usr/bin/python3 py36asr source py36asr/bin/activate pip install SpeechRecognition yum install python3-devel yum install pulseaudio-libs-devel yum install alsa-lib-devel pip install PocketSphinx
配置中文語音識別數(shù)據(jù):
下載地址:
https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/
選擇: Mandarin->cmusphinx-zh-cn-5.2.tar.gz
配置數(shù)據(jù):
cd py36asr/lib/python3.6/site-packages/speech_recognition/pocketsphinx-data/ tar zxvf cmusphinx-zh-cn-5.2.tar.gz mv cmusphinx-zh-cn-5.2 zh-cn cd zh-cn mv zh_cn.cd_cont_5000 acoustic-model mv zh_cn.lm.bin language-model.lm.bin mv zh_cn.dic pronounciation-dictionary.dict
測試文本:
自然語言理解和生成是一個多方面問題,我們對它可能也只是部分理解。
語音識別示例:
(py36asr) [root@host60 pyasrTest1]# ls
test1.py test1.wav
(py36asr) [root@host60 pyasrTest1]# cat test1.py
# -*- coding: utf-8 -*-
# /usr/bin/python
import speech_recognition as sr
r = sr.Recognizer()
test = sr.AudioFile("test1.wav")
with test as source:
audio = r.record(source)
type(audio)
c=r.recognize_sphinx(audio, language='zh-cn')
print(c)
(py36asr) [root@host60 pyasrTest1]# python test1.py
自然 語言 李杰 和 申城 是一 個 多方 面 問題 我們 對 他 可能 也 只是 部分 禮節(jié)
(py36asr) [root@host60 pyasrTest1]#本文涉及資源下載地址:https://pan.baidu.com/s/1Out0tJlb_Qs-2C06_2YHOQ
可關(guān)注微信公眾號(聊聊博文)后回復 2020062101 獲取提取碼。
本文github地址:
https://github.com/mike-zhang/mikeBlogEssays/blob/master/2020/20200621_使用SpeechRecognition進行語音識別.rst
更多Python相關(guān)文章,請關(guān)注 Python自學網(wǎng)。
網(wǎng)站欄目:創(chuàng)新互聯(lián)Python教程:使用SpeechRecognition進行語音識別
鏈接URL:http://fisionsoft.com.cn/article/dppijpo.html


咨詢
建站咨詢
