javaandroidpocketsphinx-android

Error when using addWord method of the Decoder


After trying to run those lines:

Decoder decoder = recognizer.getDecoder();
decoder.addWord("volip", "V AA L AH P",1);

I got this error:Caused by: java.lang.RuntimeException: Decoder_addWord returned -1.

I am trying adding a word to the dictionary i was able to add it directly to the cmudict-en-us.dict file. the problem was the app recognized every possible sound as the word "volip" when i used it as Key phrase using the method addKeyphraseSearch().


Solution

  • I got this error:Caused by: java.lang.RuntimeException: Decoder_addWord returned -1.

    If you already have the word in the dictionary, you can not add it again, that is why error is raised.

    You need to either add the word into the dictionary file or add word in runtime, not both.

    the problem was the app recognized every possible sound as the word "volip" when i used it as

    You need to adjust keypharse threshold then as covered in tutorial