在 Android 上安装 Pocketsphinx
我对在 Android 手机上安装 Pocketsphinx 有一些疑问,并且我无法在 CMUSphinx 的支持论坛、IRC、现有的 StackOverflow 帖子或深入的 Google 搜索上找到答案。如果这里有人愿意花一分钟时间并愿意提供帮助,我将不胜感激。
首先,我很困惑是否可以在 Android 上安装 Pocketsphinx。我相信我需要 Java bin 才能在 Android 上运行,因此我尝试安装 Sphinx 4。为了测试该程序,我创建了一个空活动并将 HelloWorld 演示文件移动到 onCreate 方法中。
然后,我将以下库添加到构建路径中:
- js.jar
- jsapi-1.0-base.jar
- junit-4.8.1.jar
- sphinx4.jar
- Tags.jar
- WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
该代码部署在运行 Android 2.2 的 Droid 2 上,但是我在运行时收到以下错误:
ERROR/AndroidRuntime(11567): Caused by: Property exception component:'wsjLoader' property:'location' - Can't locate resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
我将该 jar 文件包含在构建路径中,因此我不确定为什么会导致抛出异常。但话又说回来,我什至不确定我是否应该尝试在 Android 上安装 Sphinx 4。有谁知道我应该做什么?预先感谢您的帮助。
5/2011 更新:我为让 pocketsphinx 在 Android 上运行所做的尝试现已列在 CMU Sphinx wiki 上,网址为 http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/
I have some questions on installing Pocketsphinx on and Android phone, and I haven't been able to find answers on CMUSphinx's support forum, IRC, existing StackOverflow posts, or intensive Googling. If anyone here has a minute and would be willing to help, I'd greatly appreciate it.
First off, I'm confused as to whether I can even install Pocketsphinx on Android. I believe I need Java bins in order to run on Android, so I attempted to install Sphinx 4. To test the program, I made an empty activity and moved the HelloWorld demo file into the onCreate method.
Then, I added the following libraries to the build path:
- js.jar
- jsapi-1.0-base.jar
- junit-4.8.1.jar
- sphinx4.jar
- tags.jar
- WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
The code deploys on a Droid 2 running Android 2.2, but I get the following error at runtime:
ERROR/AndroidRuntime(11567): Caused by: Property exception component:'wsjLoader' property:'location' - Can't locate resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
I am including that jar file in the build path, so I'm not sure why that's causing an exception to be thrown. But then again, I'm not even sure I should be trying to install Sphinx 4 on Android. Does anyone know what I should do? Thanks in advance for your help.
5/2011 Update: The attempt I made to get pocketsphinx to run on Android is now listed on the CMU Sphinx wiki at http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不确定您是否已经弄清楚这一点,但我没有在任何地方读到您必须这样做。因此,如果您在 Android 上运行 PocketSphinx 时仍然遇到问题,您需要做的是创建文件夹并将声学和语言模型上传到 RecognizerTask.java 中指定的位置。
Not sure if you had this figured out but I have not read anywhere that you had to do this. So in case you are still having problems running PocketSphinx on the Android, what you need to do is to create the folders and upload the acoustics and language models to the locations specified in RecognizerTask.java.
从那时起,Android 上的 Pocketsphinx 已经更新了很多次,并获得了新的特性和功能。您可以在此处找到最新的安装方法:
http://cmusphinx.sourceforge.net/wiki/tutorialandroid
现在不需要进行任何复杂的安装,您只需在 ADT 中导入项目即可运行。
Pocketsphinx on Android has been updated many times since then and got new features and capabilities. You can find the latest installation how to here:
http://cmusphinx.sourceforge.net/wiki/tutorialandroid
There is no need to do any complex installation now, you can just import the project in ADT and it should work.
我看到您花了一些时间让 PocketSphinx 在 Android 上运行。您是否能够重现上述“勇敢的灵魂”*的成功?
但到目前为止我们得到了一个 SIGSEV :{
D/edu.cmu.pocketsphinx.demo.PocketSphinxDemo(1455):显示对话框
I/DEBUG ( 56): * ** * * * * ** * ** * ** *
I/DEBUG ( 56):构建指纹:'google/passion_vf/passion/mahimahi:2.2.1/FRG83D/291266:user/release-keys'
I/DEBUG(56):pid:1455,tid:1475>>> edu.cmu.pocketsphinx.demo <<<
I/DEBUG ( 56):信号 11 (SIGSEGV),故障地址 0000001c
我/调试(56):#00 pc 00062192 /data/data/edu.cmu.pocketsphinx.demo/lib/libpocketsphinx_jni.so
I saw that you spent some time getting PocketSphinx to run on android. Have you been able to reproduce the success of the mentioned 'brave soul'*?
But so far we get a SIGSEV :{
D/edu.cmu.pocketsphinx.demo.PocketSphinxDemo( 1455): Showing Dialog
I/DEBUG ( 56): * ** * ** * ** * ** * ** *
I/DEBUG ( 56): Build fingerprint: 'google/passion_vf/passion/mahimahi:2.2.1/FRG83D/291266:user/release-keys'
I/DEBUG ( 56): pid: 1455, tid: 1475 >>> edu.cmu.pocketsphinx.demo <<<
I/DEBUG ( 56): signal 11 (SIGSEGV), fault addr 0000001c
I/DEBUG ( 56): #00 pc 00062192 /data/data/edu.cmu.pocketsphinx.demo/lib/libpocketsphinx_jni.so
Sphinx 4 尝试使用仅存在于 java VM 中的库从系统获取麦克风,请记住 Android 在 Dalvik 机器上运行...所以基本上你永远不会使用 Sphinx 4 在 Android 上运行 Hello 演示,我'之前已经尝试过...但是我邀请您自己找出答案,只需下载 sphinx 的源代码而不是 jar,最终您将构建它,但在尝试获取麦克风时总会遇到运行时错误...所以尝试在 Android 上使用 sphinx 4 是毫无意义的...
Sphinx 4 tries to get the microphone from the system using libraries that only exist in the java VM, remember that Android runs on the Dalvik Machine...so basically you will never get the Hello demo to run on Android using Sphinx 4, I've tried that before... However I invite you to find out by yourself, just download the source code for sphinx instead of the jar, eventually you will get it to build but you will always get a runtime error wen trying to fetch the microphone...so it's pointless trying to use sphinx 4 on android...
您收到的错误是因为必须提取
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
并且内容必须放入项目的 lib 文件夹中。错误是因为它正在搜索文件夹
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
库。该文件夹位于 jar 内。我也只尝试过这样。但对我来说,现在 apk 本身没有加载状态,并出现
安装错误:INSTALL_FAILED_DEXOPT
错误。在我的代码中,启动器活动创建一个按钮,将创建 helloworld 按钮实例的 onclick 而不是main()
,因为我使用的是构造函数。以前我确实喜欢在
oncreate
方法中有一个活动,helloworld 的 main() 方法中的全部数据都在那里。 (在这里,我什至无法创建ConfigurationManager
实例,在加载helloworld.config.xml
时出现一些问题,您的帖子似乎您能够创建这些东西您能分享您的代码吗?或者只是您拥有 .config.xml 文件的框架以及您在其中所做的更改。
The error you got is because
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
must be extracted and the content must be put inside lib folder of your projectThe error is because it is searching for a folder
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
inside lib. This folder is available inside the jar.I have also only tried like this. But the thing for me is that now the apk is itself not loading states with a
Installation error: INSTALL_FAILED_DEXOPT
error. In my code a launcher activity creates a button, onclick of the button instance of helloworld would be created instead ofmain()
, as I am using a constructor.Previously I did like having an activity in the
oncreate
method, the entire data in the main() method of helloworld would be there. (Here I wasn't able to even create theConfigurationManager
instance some problem while loading thehelloworld.config.xml
Your post seems to be like you were able to create those things and all. Could you share your code? Or just the framework of where you have the
.config.xml
files and what changes you had done in that.