Mansuu....
Mansuu....

Reputation: 1226

cmusphinx in android-java.lang.RuntimeException: Decoder_setKeyphrase returned -1

I am using cmusphinx in android. First of all i executed demo project downloaded from Github. When i built my own dictionary created own keyPhrase it gives the following execption

FATAL EXCEPTION: AsyncTask #1
Process: edu.cmu.sphinx.pocketsphinx, PID: 5006
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: Decoder_setKeyphrase returned -1
at edu.cmu.pocketsphinx.PocketSphinxJNI.Decoder_setKeyphrase(Native Method)
at edu.cmu.pocketsphinx.Decoder.setKeyphrase(Decoder.java:155)
at edu.cmu.pocketsphinx.SpeechRecognizer.addKeyphraseSearch(SpeechRecognizer.java:259)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.setupRecognizer(PocketSphinxActivity.java:203)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.access$000(PocketSphinxActivity.java:51)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity$1.doInBackground(PocketSphinxActivity.java:91)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity$1.doInBackground(PocketSphinxActivity.java:85)
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) 

here is my contents of cmudict-en-us.dict

 HELLO  HH AH L OW
 HELLO(2)   HH EH L OW
 HIMANSHU   HH AH M AE N SH UW

and i set my keyphrase as

private static final String KEYPHRASE = "hello himanshu";

Upvotes: 3

Views: 223

Answers (1)

Nikolay Shmyrev
Nikolay Shmyrev

Reputation: 25220

Words are case-sensitive. Your keyphrase must be in uppercase as in the dictionary. Or words in the dictionary must be lowercase. Phonemes must be in uppercase.

To debug errors like this you can read logcat output, it provides detailed messages about the problem.

Upvotes: 2

Related Questions