Menu

Detect if an hyp is a complete fsg sentence

Help
2011-05-12
2012-09-22
  • Mattia Ferrari

    Mattia Ferrari - 2011-05-12

    Hello,
    in my application I use pocketsphinx 0.7 with fsg (defined through a jsgf
    file). While an utterance is being pronounced I wish to detect when the best
    path hypotesis is a complete sentence of the rules defined in the jsgf, so
    that I can end the utterance after a shorter period of silence after user's
    voice when the sentence seems to be completed, and a longer period when the
    sentence is half way.
    I know that the string returned by ps_get_hyp() just before calling
    ps_end_utt() can be different from the one returned after, but for my grammar
    it happens almost never, so it is not be a problem for me.
    A trivial solution could be to have my application continously check if the
    string returned by ps_get_hyp() matches some of the complete phrases of the
    grammar, but to do this I would have to parse the jsgf file myself, so it
    would be much more convenient if I can get this information from somewhere
    inside sphinx.

    Thanks for any help.

     
  • Nickolay V. Shmyrev

    Hello

    I've just added API call to find this (ps_get_hyp_final) to pocketsphinx
    trunk.

     
  • Nickolay V. Shmyrev

    know that the string returned by ps_get_hyp() just before calling
    ps_end_utt() can be different from the one returned after, but for my grammar
    it happens almost never, so it is not be a problem for me.

    And I recommend you to disable fwdflat and bestpath, they aren't really usable
    for small vocabulary.

     
  • Mattia Ferrari

    Mattia Ferrari - 2011-05-14

    Thank you very much for the help.
    I set fwdflat and bestpath to false and now it is much better.
    I tried ps_get_hyp_final and it works when I use a grammar without nested
    rules, for example:

    public <first_rule> = go away;
    

    but if I use a grammar with nested rules ps_get_hyp_final always says that the
    hyp is not final, for example:

    public <first_rule> = <second_rule>;
    <second_rule> = go away;
    

    These are the two fsgs produced:

    Without nesting

    0 2 go -0.000000
    2 3 away -0.000000
    3 1 <eps> -0.000000
    1 0
    

    With nesting

    0 2 <eps> -0.000000
    2 4 go -0.000000
    3 1 <eps> -0.000000
    4 5 away -0.000000
    5 1 <eps> -0.000000
    5 3 <eps> -0.000000
    1 0
    
     
  • Nickolay V. Shmyrev

    Hello

    This issue should be fixed in trunk, please update.

     
  • Mattia Ferrari

    Mattia Ferrari - 2011-05-29

    Thank you very much! Now it works well for me. Very useful feature.

     

Log in to post a comment.