Menu

Error condition in write_nbest

Help
Pankaj
2011-07-17
2012-09-22
  • Pankaj

    Pankaj - 2011-07-17

    Hello,

    In pocketsphinx 0.7 (release version) in batch.c in the function
    write_nbest(ps_decoder_t ps, char const nbestdir, char const uttid)
    an error condition is not being checked which leads to some crashes.
    Original code:
    _
    for (i = 0; i < n; i++)
    {
    ps_nbest_next(nbest); // This may sometimes return a NULL and hence lead to a
    crash in the next statement
    hyp = ps_nbest_hyp(nbest, &score);
    fprintf(fh, "%s %d\n", hyp, score);
    }
    ps_nbest_free(nbest);
    *_

    I think the code should be something like this:
    *{
    ps_nbest_t
    next
    for (i = 0; i < n; i++)
    {
    next = ps_nbest_next(nbest);
    if (next)
    {
    hyp = ps_nbest_hyp(nbest, &score);
    fprintf(fh, "%s %d\n", hyp, score);
    }
    else
    break;
    }
    if (next)
    ps_nbest_free(nbest);
    }
    **

     
  • Nickolay V. Shmyrev

    Thanks, this bug was already fixed in subversion trunk.

     
  • Pankaj

    Pankaj - 2011-07-18

    Hi Nicole

    Should the ps_get_hyp result match with one of the results in the nbest list??
    1. In the latest subversion trunk code (when used with FSG search) it is being observed that the ps_get_hyp doesn't matches with any of the results in the nbest list.
    2. Most of the times all the results in the nbest list are identical.

    For eg an audio clip with the word ADI was decoded as "NULL (ADI -3983)".
    While the nbest list contained four identical strings.
    ADITI -5104
    ADITI -5104
    ADITI -5104
    ADITI -5104

    Is this normal?

    Regards
    Pankaj

     
  • Nickolay V. Shmyrev

    1. In the latest subversion trunk code (when used with FSG search) it is
      being observed that the ps_get_hyp doesn't matches with any of the results in
      the nbest list.

    This issue might be a bug and require investigation. In theory it should match
    in practice there could be differences in scores which cause that.

    1. Most of the times all the results in the nbest list are identical.

    Current implementation unfortunately doesn't check for identical strings in
    n-best results. They should be filtered by application. With diverse grammar
    this is less an issue.

     

Log in to post a comment.