Pocketsphinx on android "LDA incompatible with multi-stream features" while speech recognizer setup
Pocketsphinx on android "LDA incompatible with multi-stream features" while speech recognizer setup
我在这里尝试用俄语替换英语声学模型时遇到问题:
recognizer = SpeechRecognizerSetup.defaultSetup()
.setAcousticModel(new File(assetsDir, "ru"))
错误是:"java.lang.ClassNotFoundException: edu.cmu.pocketsphinx.SphinxBaseJNI"
来自 sourceforge 我下载了所有档案并尝试了每组声学模型:zero_ru.cd_ptm_4000, zero_ru.cd_cont_4000, zero_ru.cd_semi_4000, cmusphinx-ru-5.2
将它们粘贴到 pocketsphinx-android-demo-master 应用程序的文件夹 ...\models\src\main\assets\sync\en-us-ptm 中。当然,我也更换了英语词典。
在此方法中配置 speechRecognizer 的“-hmm”内容时发生错误:
public SpeechRecognizerSetup setAcousticModel(File model) {
return this.setString("-hmm", model.getPath());
}
在口袋狮身人面像的SpeechRecognizerSetup.class中。
缺少什么 类?英语语音识别在我的 KitKat 4.4.2
上运行得非常完美
IDE: Android Studio 2.33
Gradle版本:3.3
Android插件版本:2.3.3
应用的gradle.build:
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "edu.cmu.sphinx.pocketsphinx"
minSdkVersion 14
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
productFlavors {
}
}
dependencies {
compile project(':aars')
compile project(':models')
compile 'com.android.support:appcompat-v7:25.0.0'
已编辑
Logcat:
E/cmusphinx: ERROR: "lda.c", line 71: LDA incompatible with multi-stream features (n_stream = 4)
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: edu.cmu.sphinx.pocketsphinx, PID: 23373
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.RuntimeException: new_Decoder returned -1
at edu.cmu.pocketsphinx.PocketSphinxJNI.new_Decoder__SWIG_1(Native Method)
at edu.cmu.pocketsphinx.Decoder.<init>(Decoder.java:43)
at edu.cmu.pocketsphinx.SpeechRecognizer.<init>(SpeechRecognizer.java:79)
at edu.cmu.pocketsphinx.SpeechRecognizerSetup.getRecognizer(SpeechRecognizerSetup.java:74)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.setupRecognizer(PocketSphinxActivity.java:222)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.access[=15=]0(PocketSphinxActivity.java:55)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.doInBackground(PocketSphinxActivity.java:108)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.doInBackground(PocketSphinxActivity.java:102)
at android.os.AsyncTask.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
任何帮助将不胜感激!
E/cmusphinx: ERROR: "lda.c", line 71: LDA incompatible with multi-stream features (n_stream = 4)
此错误表示您忘记从模型文件夹中删除 feature_transform
或者它保留在 sdcard 上。模型文件夹中的额外文件会中断模型加载。你需要
- 清理 phone 上 sdcard 上的模型文件夹。
- 确保资产文件夹中没有多余的文件。
所以在我的工作配置中,我使用了 "ru.txt" 来自
"zero_ru_cont_8k_v3.tar.gz" archive and accoustic model which is located in "zero_ru.cd_ptm_4000" directory of that archive. In my app I've left only keyword-activation search and grammar-based search. I've had to change ru.txt and menu.dict files extentions to .dict and .jsgf respectively. From this the app should work on conditions you've properly placed the lib and assets, you haven't left variables with any other words but russian to search and recognize, and didn't forget to add ant script to your build.gradle like it's explained here。
应该解决这些问题:
java.lang.RuntimeException: new_Decoder 返回 -1
java.lang.ClassNotFoundException: edu.cmu.pocketsphinx.SphinxBaseJNI
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Decoder_setJsgfFile 返回 -1
09-14 12:29:40.436 10908-10944/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"kws_search.c",第 528 行:短语“запуск”中的单词“запуск”字典里没有
09-1412:30:01.029 678-949/? E/RemoteViews: ANR Warning,RemoteViews can only be used once, if not, it may cause ANR in hosts such as Laucher,SystemUI.搜索键
09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545276 行:Phone 'o1'在声学模型中缺失; “ёлочкой”一词被忽略
09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545277 行:Phone 'o1' 是声学模型缺失; “ёлочку”一词被忽略
09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545278 行:Phone 'o1' 是声学模型缺失; “ёлочной”一词被忽略
09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545279 行:Phone 'o1' 是声学模型缺失;单词“ёлочный”被忽略
09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545280 行:Phone 'o1' 是声学模型缺失;单词“ём”被忽略
09-14 12:06:09.114 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545281 行:Phone 'o1' 是声学模型缺失;单词“ёмкий”被忽略
09-14 12:06:09.114 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545282 行:Phone 'o1' 是声学模型缺失;单词“ёмкими”被忽略
我在这里尝试用俄语替换英语声学模型时遇到问题:
recognizer = SpeechRecognizerSetup.defaultSetup()
.setAcousticModel(new File(assetsDir, "ru"))
错误是:"java.lang.ClassNotFoundException: edu.cmu.pocketsphinx.SphinxBaseJNI"
来自 sourceforge 我下载了所有档案并尝试了每组声学模型:zero_ru.cd_ptm_4000, zero_ru.cd_cont_4000, zero_ru.cd_semi_4000, cmusphinx-ru-5.2 将它们粘贴到 pocketsphinx-android-demo-master 应用程序的文件夹 ...\models\src\main\assets\sync\en-us-ptm 中。当然,我也更换了英语词典。 在此方法中配置 speechRecognizer 的“-hmm”内容时发生错误:
public SpeechRecognizerSetup setAcousticModel(File model) {
return this.setString("-hmm", model.getPath());
}
在口袋狮身人面像的SpeechRecognizerSetup.class中。 缺少什么 类?英语语音识别在我的 KitKat 4.4.2
上运行得非常完美IDE: Android Studio 2.33
Gradle版本:3.3
Android插件版本:2.3.3
应用的gradle.build:
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "edu.cmu.sphinx.pocketsphinx"
minSdkVersion 14
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
productFlavors {
}
}
dependencies {
compile project(':aars')
compile project(':models')
compile 'com.android.support:appcompat-v7:25.0.0'
已编辑 Logcat:
E/cmusphinx: ERROR: "lda.c", line 71: LDA incompatible with multi-stream features (n_stream = 4)
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: edu.cmu.sphinx.pocketsphinx, PID: 23373
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.RuntimeException: new_Decoder returned -1
at edu.cmu.pocketsphinx.PocketSphinxJNI.new_Decoder__SWIG_1(Native Method)
at edu.cmu.pocketsphinx.Decoder.<init>(Decoder.java:43)
at edu.cmu.pocketsphinx.SpeechRecognizer.<init>(SpeechRecognizer.java:79)
at edu.cmu.pocketsphinx.SpeechRecognizerSetup.getRecognizer(SpeechRecognizerSetup.java:74)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.setupRecognizer(PocketSphinxActivity.java:222)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.access[=15=]0(PocketSphinxActivity.java:55)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.doInBackground(PocketSphinxActivity.java:108)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.doInBackground(PocketSphinxActivity.java:102)
at android.os.AsyncTask.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
任何帮助将不胜感激!
E/cmusphinx: ERROR: "lda.c", line 71: LDA incompatible with multi-stream features (n_stream = 4)
此错误表示您忘记从模型文件夹中删除 feature_transform
或者它保留在 sdcard 上。模型文件夹中的额外文件会中断模型加载。你需要
- 清理 phone 上 sdcard 上的模型文件夹。
- 确保资产文件夹中没有多余的文件。
所以在我的工作配置中,我使用了 "ru.txt" 来自 "zero_ru_cont_8k_v3.tar.gz" archive and accoustic model which is located in "zero_ru.cd_ptm_4000" directory of that archive. In my app I've left only keyword-activation search and grammar-based search. I've had to change ru.txt and menu.dict files extentions to .dict and .jsgf respectively. From this the app should work on conditions you've properly placed the lib and assets, you haven't left variables with any other words but russian to search and recognize, and didn't forget to add ant script to your build.gradle like it's explained here。
应该解决这些问题:
java.lang.RuntimeException: new_Decoder 返回 -1
java.lang.ClassNotFoundException: edu.cmu.pocketsphinx.SphinxBaseJNI
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Decoder_setJsgfFile 返回 -1
09-14 12:29:40.436 10908-10944/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"kws_search.c",第 528 行:短语“запуск”中的单词“запуск”字典里没有 09-1412:30:01.029 678-949/? E/RemoteViews: ANR Warning,RemoteViews can only be used once, if not, it may cause ANR in hosts such as Laucher,SystemUI.搜索键
09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545276 行:Phone 'o1'在声学模型中缺失; “ёлочкой”一词被忽略 09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545277 行:Phone 'o1' 是声学模型缺失; “ёлочку”一词被忽略 09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545278 行:Phone 'o1' 是声学模型缺失; “ёлочной”一词被忽略 09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545279 行:Phone 'o1' 是声学模型缺失;单词“ёлочный”被忽略 09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545280 行:Phone 'o1' 是声学模型缺失;单词“ём”被忽略 09-14 12:06:09.114 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545281 行:Phone 'o1' 是声学模型缺失;单词“ёмкий”被忽略 09-14 12:06:09.114 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:错误:"dict.c",第 195 行:第 545282 行:Phone 'o1' 是声学模型缺失;单词“ёмкими”被忽略