赞
踩
折腾了一天终于把这个Demo跑起来,虽然我还是不太明白,还是想把它记录下来,免得很快又忘记了。有一篇博客很详细地介绍这个:http://blog.csdn.net/zouxy09/article/details/7978108
NDK=/cygdrive/e/software/android-ndk-r9,打开Cygwin就可以输入:
cd $NDK
cd /cygdrive/e/software/Tools/swigwin-1.3.40
- sh autogen.sh
- ./configure
- make
- make install
输入swig -version能查看相应版本表示已安装成功
- sh autogen.sh
- ./configure
- make
- make install
cd /cygdrive/e/Sphinx/pocketsphinx/swig
还是报错,不清楚是什么原因,不过edu文件夹已经生成了,把这个文件夹拷贝到Demo程序的jni文件夹下,用linux执行也可以
cp -r ./pocketsphinx/swig/edu ./PocketSphinxAndroidDemo/jni/
cd /cygdrive/e/Sphinx/PocketSphinxAndroidDemo/jni
使用NDK build,
$NDK/ndk-build -B
--login -c "cd /cygdrive/f/MyCode/Android/voice/PocketSphinxDemo && $NDK/ndk-build"
- public RecognizerTask() {
- pocketsphinx
- .setLogfile("/sdcard/Android/data/edu.cmu.pocketsphinx/pocketsphinx.log");
- Config c = new Config();
- /*
- * In 2.2 and above we can use getExternalFilesDir() or whatever it's
- * called
- */
- c.setString("-hmm",
- "/sdcard/Android/data/edu.cmu.pocketsphinx/hmm/en_US/hub4wsj_sc_8k");
- c.setString("-dict",
- "/sdcard/Android/data/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.dic");
- c.setString("-lm",
- "/sdcard/Android/data/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.DMP");
- /*
- c.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");
- */
- .....
- .....
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。