Menu

Same input produces different hyptheses

Help
2010-11-17
2012-09-22
  • Gregory Hassett

    Gregory Hassett - 2010-11-17

    Hi, I am creating a pocketsphinx decoder to decode audio. In my grammar and
    dictionary, "Operator, what time is it" is a valid command.

    I capture audio of me saying, clearly, "What time is it", and pass it to the
    decoder. It usually gets it right -- the first time I call it!

    Subsequent calls are unpredictable... eventually I created a simple test
    routine that passes the same audio, over and over, into the same ps_decoder.
    And lo and behold, it gets different results each time. I thought that maybe I
    was passing too much data at once to ps_process_raw, but I tried breaking it
    into small chucks (same result). I thought maybe I'm missing some kind of call
    to "ps_reset_decoder" or something, but I could not find any such API method.

    Any idea why pocketsphinx would return different results for subsequent runs
    on the same data? Here's my (very simple) C test function, and its results:

    void testPS (ps_decoder_t *ps, SInt16* buf, int count)
    {
        int32 recognitionScore = 0;
        char const *pocketSphinxHypothesis = NULL;
        char const *outUtteranceId = NULL;
    
        for (int i = 0;i < 500; ++i)
        {
            ps_start_utt (ps, NULL);
            ps_process_raw (ps, buf, count, FALSE, FALSE);
            ps_end_utt (ps);
            pocketSphinxHypothesis = ps_get_hyp (ps, &recognitionScore, &outUtteranceId);
    
            if (pocketSphinxHypothesis)
            {
                printf ("Run %d gets hypo: %s\n", i, pocketSphinxHypothesis);
            }
            else
            {
                printf ("Run %d gets null hypo\n", i);
            }
    
        }
    }
    
    Run 0 gets hypo: operator what time is it
    Run 1 gets hypo: operator what time
    Run 2 gets null hypo
    Run 3 gets hypo: operator
    Run 4 gets null hypo
    Run 5 gets null hypo
    Run 6 gets null hypo
    Run 7 gets hypo: operator
    Run 8 gets null hypo
    Run 9 gets hypo: operator
    Run 10 gets null hypo
    Run 11 gets hypo: operator
    Run 12 gets null hypo
    Run 13 gets null hypo
    Run 14 gets null hypo
    Run 15 gets null hypo
    Run 16 gets null hypo
    Run 17 gets null hypo
    Run 18 gets null hypo
    Run 19 gets null hypo
    Run 20 gets hypo: operator
    Run 21 gets null hypo
    Run 22 gets hypo: operator long
    Run 23 gets null hypo
    Run 24 gets null hypo
    Run 25 gets hypo: operator
    Run 26 gets hypo: operator
    Run 27 gets hypo: operator
    Run 28 gets null hypo
    Run 29 gets hypo: operator
    Run 30 gets null hypo
    Run 31 gets null hypo
    Run 32 gets null hypo
    Run 33 gets null hypo
    Run 34 gets null hypo
    Run 35 gets null hypo
    Run 36 gets hypo: operator
    Run 37 gets hypo: operator what time is it
    

    etc., etc.,

     
  • Nickolay V. Shmyrev

    Hello

    I can't reproduce your issue. Please provide a test case.

     

Log in to post a comment.