iOS-PocketSphinx——安裝PocketSphinx

傳送門

當(dāng)前文章:《iOS-PocketSphinx——安裝PocketSphinx》

《iOS-PocketSphinx——構(gòu)建iOS使用的SDK》

《iOS-PocketSphinx——建立語音詞典》

《iOS-PocketSphinx——建立語言模型》

《iOS-PocketSphinx——調(diào)整默認(rèn)聲學(xué)模型》

系統(tǒng)環(huán)境

Mac OS 10.15.6

CMUSphinx工具包概述

  • Sphinxbase — Pocketsphinx所需要的支持庫,主要完成的是語音信號的特征提取。
  • Pocketsphinx — 用C語言編寫的輕量級識別庫,主要是進行識別的。
  • Sphinxtrain — 聲學(xué)模型訓(xùn)練工具

安裝PocketSphinx

PocketSphinx是一個依賴于另一個名為SphinxBase的庫的庫,該庫在所有CMUSphinx項目中提供通用功能。要安裝Pocketsphinx,需要同時安裝Pocketsphinx和Sphinxbase。

將sphinxbase、pocketsphinx放在同一目錄下
首先構(gòu)建并安裝SphinxBase(sphinxbase必須先安裝)

$ cd sphinxbase
$ ./autogen.sh
$ make
$ sudo make install

然后構(gòu)建Pocketsphinx(步驟相同)

$ cd pocketsphinx
$ ./autogen.sh
$ make
$ sudo make install

安裝SphinxTrain

$ cd sphinxtrain
$ ./autogen.sh
$ make
$ sudo make install

測試PocketSphinx

運行pocketsphinx_continuous -inmic yes檢查其是否可以識別您在麥克風(fēng)中說的單詞

$ pocketsphinx_continuous -inmic yes

會出現(xiàn)Ready... Listening...
對麥克風(fēng)說 "hello",終端也識別出了"hello",測試成功

INFO: continuous.c(275): Ready....
INFO: continuous.c(261): Listening...
INFO: cmn_live.c(120): Update from < 15.47 11.52 -23.59  5.01 -7.99 -10.39  3.40 -10.32  6.99  2.10 -3.12  3.31 -4.84 >
INFO: cmn_live.c(138): Update to   < 17.67 16.51 -23.53  6.89 -6.99 -10.99  4.08 -9.21  8.38  2.91 -1.46  4.42 -5.29 >
INFO: ngram_search_fwdtree.c(1550):     3949 words recognized (43/fr)
INFO: ngram_search_fwdtree.c(1552):   347666 senones evaluated (3821/fr)
INFO: ngram_search_fwdtree.c(1556):  2459122 channels searched (27023/fr), 61062 1st, 148131 last
INFO: ngram_search_fwdtree.c(1559):     7585 words for which last channels evaluated (83/fr)
INFO: ngram_search_fwdtree.c(1561):   213126 candidate words for entering last phone (2342/fr)
INFO: ngram_search_fwdtree.c(1564): fwdtree 1.12 CPU 1.227 xRT
INFO: ngram_search_fwdtree.c(1567): fwdtree 2.46 wall 2.704 xRT
INFO: ngram_search_fwdflat.c(302): Utterance vocabulary contains 173 words
INFO: ngram_search_fwdflat.c(948):     2874 words recognized (32/fr)
INFO: ngram_search_fwdflat.c(950):   128628 senones evaluated (1413/fr)
INFO: ngram_search_fwdflat.c(952):   264648 channels searched (2908/fr)
INFO: ngram_search_fwdflat.c(954):    12085 words searched (132/fr)
INFO: ngram_search_fwdflat.c(957):     8934 word transitions (98/fr)
INFO: ngram_search_fwdflat.c(960): fwdflat 0.12 CPU 0.137 xRT
INFO: ngram_search_fwdflat.c(963): fwdflat 0.13 wall 0.138 xRT
INFO: ngram_search.c(1250): lattice start node <s>.0 end node </s>.57
INFO: ngram_search.c(1276): Eliminated 1 nodes before end node
INFO: ngram_search.c(1381): Lattice has 483 nodes, 4953 links
INFO: ps_lattice.c(1376): Bestpath score: -2866
INFO: ps_lattice.c(1380): Normalizer P(O) = alpha(</s>:57:89) = -216645
INFO: ps_lattice.c(1437): Joint P(O,S) = -247947 P(S|O) = -31302
INFO: ngram_search.c(872): bestpath 0.02 CPU 0.019 xRT
INFO: ngram_search.c(875): bestpath 0.02 wall 0.019 xRT
hello

測試識別語音文件

cd到音頻文件所在目錄,用pocketsphinx_continuous命令識別005.wav音頻文件,輸出audio.result文本文件(音頻文件必須是單聲道16kHz)

$ cd /Users/.../pocketsphinx/test/data/cards 
$ pocketsphinx_continuous -infile 005.wav > audio.result

打開audio.result,內(nèi)容為:

eight of spades for up close seven of hearts

識別成功

安裝其他工具

《iOS-PocketSphinx——安裝tensorflow的坎坷過程》

《iOS-PocketSphinx——安裝g2p-seq2seq》

參考資料:

使用PocketSphinx構(gòu)建應(yīng)用程序(官方教程):https://cmusphinx.github.io/wiki/tutorialpocketsphinx/

CMUSphinx文檔:https://cmusphinx.github.io/wiki/

Cephei

Pocketsphinx-Api文檔

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容