pocketsphinx-android icon indicating copy to clipboard operation
pocketsphinx-android copied to clipboard

Handle an error, when phrase not contains words from JSGF

Open DenBond7 opened this issue 10 years ago • 2 comments

Hello. Please help me. How to handle an error, when phrase not contains words from JSGF? In the logcat a see next:

ERROR: "fsg_search.c", line 910: Final result does not match the grammar in frame 155.

I want handle this error and I want say: "Sorry, I didn’t recognize what you said. Please, say again."

DenBond7 avatar Nov 26 '14 09:11 DenBond7

You probably should get null in onResult() callback.

On Wed, Nov 26, 2014 at 7:41 PM, Den [email protected] wrote:

Hello. Please help me. How to handle an error, when phrase not contains words from JSGF? In the logcat a see next:

ERROR: "fsg_search.c", line 910: Final result does not match the grammar in frame 155.

I want handle this error and I want say: "Sorry, I didn’t recognize what you said. Please, say again."

— Reply to this email directly or view it on GitHub https://github.com/cmusphinx/pocketsphinx-android/issues/10.

Sincerely, Alexander

mbait avatar Nov 26 '14 16:11 mbait

As suggested by @mbait, following code-segment helps to handle segfault on this issue:

..
..
//get hypothesis
int score = 0;
const char* hyp = ps_get_hyp(decoder, &score);
if ( hyp != NULL){
     std::cout<<"(Hyp, Score) : ("<<hyp<<","<<score<<")"<<std::endl;
}

//next recognition cycle
status = ps_start_utt(decoder);
..
..

aspratyush avatar Jul 08 '15 10:07 aspratyush