我在尝试用俄语取代英语声学模型时遇到了一个问题:
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());
}
在pocketsphinx的SpeechRecognizerSetup.class中。 缺少哪些课程?英语语音识别在我的KitKat 4.4.2上非常完美。
IDE:Android Studio 2.33
Gradle版本:3.3
Android插件版本:2.3.3
app的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$3.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$1.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$000(PocketSphinxActivity.java:55)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity$1.doInBackground(PocketSphinxActivity.java:108)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity$1.doInBackground(PocketSphinxActivity.java:102)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.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)
任何帮助将不胜感激!
答案 0 :(得分:0)
E / cmusphinx:错误:“lda.c”,第71行:LDA与多流功能不兼容(n_stream = 4)
此错误表示您忘记从模型文件夹中删除feature_transform
,或者它仍保留在SD卡上。模型文件夹中的额外文件会中断模型加载。你需要
答案 1 :(得分:0)
所以在我的工作配置中,我使用了“ru.txt”字典 "zero_ru_cont_8k_v3.tar.gz"存档和声学模型,位于该存档的“zero_ru.cd_ptm_4000”目录中。在我的应用程序中,我只留下了关键字激活搜索和基于语法的搜索。我必须分别将ru.txt和menu.dict文件扩展名更改为.dict和.jsgf。从这个应用程序应该工作在你已经正确放置lib和资产的条件,你没有留下任何其他单词的变量,但俄罗斯搜索和识别,并且不要忘记将ant脚本添加到你的build.gradle像它解释了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:ERROR:“kws_search.c”,第528行:短语'запуск'中的单词'запуск'缺少字典 09-14 12:30:01.029 678-949 /? E / RemoteViews:ANR警告,RemoteViews只能使用一次,否则可能会导致Laucher,SystemUI等主机出现ANR。搜索键
09-14 12:06:09.113 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:ERROR:“dict.c”,第195行:第545276行:电话'o1'在声学模型中迷失;单词'ёлочкой'被忽略了 09-14 12:06:09.113 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:错误:“dict.c”,第195行:第545277行:电话'o1'正在声学模型中;单词'ёлочку'被忽略了 09-14 12:06:09.113 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:错误:“dict.c”,第195行:第545278行:电话'o1'正在声学模型中;单词'ёлочной'被忽略了 09-14 12:06:09.113 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:错误:“dict.c”,第195行:第545279行:电话'o1'正在声学模型中;单词'ёлочный'被忽略了 09-14 12:06:09.113 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:错误:“dict.c”,第195行:第545280行:电话'o1'正在声学模型中;单词'ём'被忽略了 09-14 12:06:09.114 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:错误:“dict.c”,第195行:第545281行:电话'o1'在声学模型中徘徊;单词'ёмкий'被忽略了 09-14 12:06:09.114 2298-2339 / edu.cmu.sphinx.pocketsphinx E / cmusphinx:错误:“dict.c”,第195行:第545282行:电话'o1'正在声学模型中;单词'ёмкими'忽略