ROS中PocketSphinx语音识别_安装arbotix simulator仿真环境_turtlebot的仿真语音控制
这个博客也有写到
可参考:http://www.pirobot.org/blog/0022/
http://blog.csdn.net/zouxy09/article/details/7949126
Creating A Vocabulary
It is easy to create a new vocabulary or corpusas it is referred to in PocketSphinx. First, create asimple text file with one word or phrase per line. Here is acorpus that could be used to drive your robot around using voicecommands. We will store it in a file called nav_commands.txt in the config subdirectory of the pi_speech_tutorial package:$ roscd pi_speech_tutorial/config
$ more nav_commands.txt
pause speech
continue speech
move forward
move backward
move back
move left
move right
go forward
go backward
go back
go left
go right
go straight
come forward
come backward
come left
come right
turn left
turn right
rotate left
rotate right
faster
speed up
slower
slow down
quarter speed
half speed
full speed
stop
stop now
halt
abort
kill
panic
help
help me
freeze
turn off
shut down
cancel
When you enter your phrases, try not to mix upper and lower case and donot use punctuation marks. Also, if want to include a number suchas 54, spell it out as "fifty four".
Before we can use this corpus with PocketSphinx, we need to compileit into special dictionary and pronunciation files. Thiscan be done using the online CMU language model (lm) tool located at:
http://www.speech.cs.cmu.edu/tools/lmtool-new.html
Follow the directions to upload your nav_commands.txtfile, click the "Compile Knowledge Base" button, then download theresulting compressed tarball that contains all the language modelfiles. Extract thesefiles into the config subdirectory of the pi_speech_tutorial package. The files will all begin with the same number, such as 3026.dic, 3026.lm,etc. These files define your vocabulary as a language model thatPocketSphinx can understand. You can rename all these files tosomething more memorable using a command like the following (the4-digit number will likely be different in your case):
$ roscd pi_speech_tutorial/config
$ rename -f 's/3026/nav_commands/' *
<launch>
<node name="recognizer" pkg="pocketsphinx" type="recognizer.py" output="screen">
<param name="lm" value="$(find pi_speech_tutorial)/config/nav_commands.lm"/>
<param name="dict" value="$(find pi_speech_tutorial)/config/nav_commands.dic"/>
</node>
</launch>
Launch this file and test speech recognition by monitoring the /recognizer/output topic:
$ roslaunch pi_speech_tutorial voice_nav_commands.launch
And in a separate terminal:$ rostopic echo /recognizer/output
利用在线工具建立语言模型
(1)创建一个语料库:
语料库实际上就是一些文本的集合,包含了你需要识别的语音的文字的一些集合,例如句子啊,词啊等等。
#vi corpus.txt
输入如下内容:
stop
forward
backward
turn right
turn left
保存退出
(2)利用在线工具LMTool建立语言模型:
进入
http://www.speech.cs.cmu.edu/tools/lmtool-new.html生成字典文件* .dic 和语言模型文件 *.lm,例如:
生成TAR2916.tar.gz
tar xzf TAR2916.tar.gz
2916.corpus 2916.lm 2916.sent.arpabo 2916.vocab
2916.dic 2916.sent 2916.token
真正有用的是.dic、.lm的文件
(3)测试结果:
pocketsphinx_continuous解码器用-lm选项来指定要加载的语言模型,-dict来指定要加载的字典。
#pocketsphinx_continuous -lm 2916.lm -dict 2916.dic