Menu

Segmentation fault in Python get_hyp()

Help
icax0r
2012-04-04
2012-09-22
  • icax0r

    icax0r - 2012-04-04

    Hello,

    I am using the Pocketsphinx Python bindings on Ubuntu, and I find that I am
    getting the following error:

    ERROR: "fsg_search.c", line 1092: Final state not reached in frame 268
    Segmentation fault
    

    I have researched the "final state not reached" error, and found that this
    occurs when you try to make the decoder recognize something that is not
    accepted by its grammar - this is indeed the case (my decoder is initialized
    with a .jsgf grammar and I am giving it an utterance not in the grammar) so
    the error is expected, but not the segmentation fault - is there any way to
    check that the decoder didn't recognize anything, catch the error, and avoid
    the segfault? Is this segmentation fault the expected behavior for something
    that can't be recognized, or is something else going wrong?

    My grammar (mygram.jsgf) is the following:

    #JSGF V1.0;
    grammar goforward;
    public <move> = GO <direction> <distance> [METER | METERS];
    <direction>= FORWARD | BACKWARD;
    <distance>= (ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | TEN | TWENTY)+;
    

    My dictionary is the following (mydict.dic):

    go  G OW
    GO  G OW
    METER   M IY T ER
    METERS  M IY T ER S
    FORWARD F AO R W ER D
    BACKWARD    B AE K W ER D
    ONE HH W AH N
    ONE(2)  W AH N
    TWO T UW
    THREE   TH R IY
    FOUR    F AO R
    FIVE    F AY V
    SIX S IH K S
    SEVEN   S EH V AH N
    EIGHT   EY T
    NINE    N AY N
    TEN T EH N
    TWENTY  T W EH N IY
    TWENTY(2)   T W EH N T IY
    

    I have two .wav files, goforward.wav (which says "go forward eight meters"),
    and test.wav (which just says "test"),

    and I am initializing the decoder this way:

    import pocketsphinx as ps
    decoder = ps.decoder(hmm='share/pocketsphinx/model/hmm/wsj1', jsgf='mygram.jsgf', dict='mydict.dic')
    

    I recognize the in-grammar utterance this way:

    fh = file('goforward.wav', 'rb')
    decoder.decode_raw(fh)
    

    which outputs:

    INFO: cmn.c(175): CMN: 21.19 -3.35  1.09 -1.22 -1.02 -0.44 -0.31 -0.01 -0.33 -0.01 -0.24  0.06  0.08 
    INFO: fsg_search.c(1016): 396 frames, 7676 HMMs (19/fr), 22660 senones (57/fr), 7299 history entries (18/fr)
    
    63510
    

    and then to see the result:

    decoder.get_hyp()
    

    which outputs, as expected:

    INFO: fsg_search.c(1395): Start node <sil>.0:2:45
    INFO: fsg_search.c(1434): End node <sil>.259:261:395 (-851608)
    INFO: fsg_search.c(1650): lattice start node <sil>.0 end node <sil>.259
    INFO: ps_lattice.c(1228): Normalizer P(O) = alpha(<sil>:259:395) = -2028183
    INFO: ps_lattice.c(1266): Joint P(O,S) = -2029234 P(S|O) = -1051
    ('GO FORWARD EIGHT METERS', '000000000', -40584706)
    

    So then when I try it with the other .wav file:

    fh.close()
    fh = file('test.wav', 'rb')
    decoder.decode_raw(fh)
    

    which outputs:

    INFO: cmn.c(175): CMN: 48.97 -1.35 -0.69  0.19 -0.07  0.76  1.09  0.47  0.03 -0.61 -0.86  0.14 -0.11 
    INFO: fsg_search.c(1016): 268 frames, 1468 HMMs (5/fr), 9431 senones (35/fr), 220 history entries (0/fr)
    
    43030
    

    and then I say:

    decoder.get_hyp()
    

    which gives the error

    ERROR: "fsg_search.c", line 1092: Final state not reached in frame 268
    Segmentation fault
    
     
  • Nickolay V. Shmyrev

    Hello

    When you ask about segmentation faults please provide the information about
    pocketsphinx version you are using. Please try the same with the latest
    version.

     
  • icax0r

    icax0r - 2012-04-04

    The version I am using is 0.6.1, which as far as I can tell is the latest
    version.

     
  • Nickolay V. Shmyrev

    Latest version is 0.7. Please verify if this bug was not already fixed long
    time ago. I even recommend you to compile a sphinxbase snapshot.

     
  • icax0r

    icax0r - 2012-04-06

    Thanks very much, this has solved the problem.

    Another question I had was about the grammar not being strictly followed.
    Although I define a JSGF grammar, I often get ASR results that are sentences
    not in the grammar. I have read previous threads on this topic, and it sounds
    like this is intentional. How is the language model being made out of my
    grammar - is Pocketsphinx turning my JSGF grammar into an n-gram model?

     
  • Nickolay V. Shmyrev

    Not following the grammar was a feature of previous releases. You can checkout
    snapshot where grammar should be more strictly followed.

     

Log in to post a comment.