1

我嘗試與俄羅斯一個我更換英語accoustic模式面臨着一個問題:Pocketsphinx Android上的「LDA多流功能不兼容」,而語音識別設置

recognizer = SpeechRecognizerSetup.defaultSetup() 
       .setAcousticModel(new File(assetsDir, "ru")) 

的錯誤是:「java.lang中.ClassNotFoundException:edu.cmu.pocketsphinx.SphinxBaseJNI」

sourceforge我已經下載了所有的檔案,並試圖每組accoustic型號:zero_ru.cd_ptm_4000,zero_ru.cd_cont_4000,zero_ru.cd_semi_4000,cmusphinx-RU-5.2 通過將它們粘貼到pocketsphinx-andr的文件夾... \ models \ src \ main \ assets \ sync \ en-us-ptm中oid-demo-master應用程序。當然,我也替換了英文字典。在pocketsphinx的SpeechRecognizerSetup.class

public SpeechRecognizerSetup setAcousticModel(File model) { 
     return this.setString("-hmm", model.getPath()); 
    } 

:在配置speechRecognizer的「-hmm」的東西這個方法裏面 的錯誤發生。 缺少哪些類?英語語音識別的工作只是完美的我的奇巧4.4.2

IDE:機器人工作室2.33

搖籃版本: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$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

您的項目中是否有此類SphinxBaseJNI? –

+0

@ShriyanshGautam是的,我有 – Sophour

回答

0

所以在我的工作配置我用「ru.txt」字典從 "zero_ru_cont_8k_v3.tar.gz"歸檔和accoustic模型,它位於該歸檔的「zero_ru.cd_ptm_4000」目錄。在我的應用程序中,我只剩下關鍵字激活搜索和基於語法的搜索。我必須分別將ru.txt和menu.dict文件擴展名更改爲.dict和.jsgf。從這個應用程序應該適用於你已經正確放置庫和資產的條件,你沒有留下任何其他詞的變量,但俄羅斯的搜索和識別,並沒有忘記添加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

十二月9日至14日:29:40.436 10908-10944/edu.cmu.sphinx.pocketsphinx E/cmusphinx:錯誤:「kws_search.c」,行528:短語'запуск'中的詞'запуск'在詞典中缺失 09-14 12:30:01.029 678-949 /? E/RemoteViews:ANR警告,RemoteViews只能使用一次,否則可能導致主機中的ANR,如Laucher,SystemUI。搜索鍵

09-14 12:06:09.113 2298-2339/edu.cmu.sphinx.pocketsphinx E/cmusphinx:錯誤:「dict.c」,第195行:第545276行:Phone'o1'is mising在聲學模型中;忽略字'ёлочкой' 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行:Phone'o1'正在啓動聲學模型;忽略'ёмкими'

0

E/cmusphinx: ERROR: "lda.c", line 71: LDA incompatible with multi-stream features (n_stream = 4)

這個錯誤意味着你忘了從模型文件夾中刪除feature_transform或它保持在SD卡。模型文件夾中的額外文件會中斷模型加載。你需要

  1. 在手機上的SD卡上清潔模型文件夾。
  2. 確保資產文件夾中沒有額外的文件。
+0

謝謝你回答,但我已經自己解決了它)是的,問題是所有關於資產。我使用了錯誤的字典和文件擴展。我會在稍後顯示細節 – Sophour