利用pocketsphinx在安卓手机上建立一个语言识别的程序

上传人:mg****85 文档编号:34141036 上传时间:2018-02-21 格式:DOCX 页数:4 大小:21.41KB
返回 下载 相关 举报
利用pocketsphinx在安卓手机上建立一个语言识别的程序_第1页
第1页 / 共4页
利用pocketsphinx在安卓手机上建立一个语言识别的程序_第2页
第2页 / 共4页
利用pocketsphinx在安卓手机上建立一个语言识别的程序_第3页
第3页 / 共4页
利用pocketsphinx在安卓手机上建立一个语言识别的程序_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《利用pocketsphinx在安卓手机上建立一个语言识别的程序》由会员分享,可在线阅读,更多相关《利用pocketsphinx在安卓手机上建立一个语言识别的程序(4页珍藏版)》请在金锄头文库上搜索。

1、Building Pocketsphinx On AndroidI know you waited for the instruction for a long time, here it is. Cudos to Matthew Cooper who wrote this. These instruction should work on any GNU/Linux distributuion, for example on Fedora or Ubuntu. This is also written for phones have OS 2.2 or higher. Previous OS

2、 requires a different path to the sdcard, so it will be easy to adapt this guide.Download and build pocketsphinxTo run pocketsphinx download the following from http:/ snapshotpocketsphinx snapshotThen download PocketSphinxDemo archive fromPocketsphinxAndroidDemo snapshotUnzip all three folders into

3、a place where you will remember to find them. It is necessary to unzip both pocketsphinx and sphinxbase folders into the same parent directory.Open up the terminal and type:sudo -ifollowed by your password. This will give you root access.You will need swig later on so type:apt-get install swigoryum

4、install swigNow, cd into sphinxbase and run the following commands from command line:./autogen.sh./configuremakemake installcd into pocketsphinx and type:./autogen.sh./configuremakemake installNow cd into PocketSphinxDemo/jni folderOpen the Android.mk file, found in the jni folder, and change the SP

5、HINX_PATH(line #5) to the parent folder holding pocketsphinx and sphinxbase.from command line type:the-path-to-your-ndk-folder/ndk-build -B Of course, substitude the real path to your ndk folder for the-path-to-your-ndk-folderEclipseNow open Eclipse and import the PocketSphinxDemo.In the Navigator V

6、iew look for PocketSphinxDemo project. Right click on it and select properties. The properties screen will pop up and you will need to select Builders. In the Builders screen you will see SWIG and NDK build.Click on NDK build and edit.In the edit screen change the field Location to point to your ndk

7、-folder you have on your machine. Click on the Refresh tab and select “The project containing the selected resource”Click on the Build Options tab and deselect “Specify working set of relevant resources”Apply changes and exit the configuration for NDK build.Click on SWIG and edit.You will not need t

8、o change the Location since downloaded swig at the start of the tutorial.In the refresh tab select “The folder containing the selected resource”In the Build Options tab deselect “Specifiy working set of relevant resources”Apply changes and exit the configuration for SWIG.PhoneConnect to your android

9、 phone and create the edu.cmu.pocketsphinx folder at /mnt/sdcardYou can do this by opening terminal command and typing:adb shellIn shell type:mkdir /mnt/sdcard/edu.cmu.pocketsphinxnow cd into the edu.cmu.pocketsphinx folder that is located on your phone and create the following folder structure:edu.

10、cmu.pocketsphinx|- hmm| | - en_US| | - hub4wsj_sc_8k|- lm|- en_USNow type quit to leave adb shell.While still in terminal you will need to push files from your computer onto the phone.cd into pocketsphinx/model/hmm/en_US/ and type:adb push ./hub4wsj_sc_8k /mnt/sdcard/edu.cmu.pocketsphinx/hmm/en_US/h

11、ub4wsj_sc_8kNow cd into pocketsphinx/model/lm/ in your and type:adb push ./en_US /mnt/sdcard/edu.cmu.pocketsphinx/lm/en_USNow open the RecognizerTask.java found in/src/edu/cmu/pocketsphinx/demoThere are declared paths to a structure that is not valid on a 2.2 phone. We will need to change the paths

12、so that they work correctly. Here is my code for the section.pocketsphinx.setLogfile(/mnt/sdcard/edu.cmu.pocketsphinx/pocketsphinx.log);Config c = new Config();/* In 2.2 and above we can use getExternalFilesDir() or whatever its called*/c.setString(-hmm, /mnt/sdcard/edu.cmu.pocketsphinx/hmm/en_US/hu

13、b4wsj_sc_8k);c.setString(-dict, /mnt/sdcard/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.dic);c.setString(-lm, /mnt/sdcard/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.DMP);c.setString(-rawlogdir, /mnt/sdcard/edu.cmu.pocketsphinx); / Only use it to store the audioIf your model is different, you will have to u

14、se different paths, for example fo rthe mandarin modelc.setString(-hmm, /sdcard/Android/data/edu.cmu.pocketsphinx/hmm/zh/tdt_sc_8k);c.setString(-dict, /sdcard/Android/data/edu.cmu.pocketsphinx/lm/zh_TW/mandarin_notone.dic);c.setString(-lm, /sdcard/Android/data/edu.cmu.pocketsphinx/lm/zh_TW/gigatdt.5000.DMP);Now build and run the project

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号