我在这里尝试用俄语替换英语声学模型时遇到了一个问题:
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,方法是将它们粘贴到文件夹 ...\models\src\main\ pocketsphinx-android-demo-master 应用程序的 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
摇篮版本:3.3
安卓插件版本: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$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)
任何帮助将不胜感激!