Menu

Change grammar dynamically

Help
2017-06-30
2020-03-18
  • Carlo Benussi

    Carlo Benussi - 2017-06-30

    HI. I am developing an application which allows the user to dial a phone number vocally.
    In order to not introduce too many variancies in the main Grammar, I did not put a number dialing option in it. I thought instead about a two steps dialog between the user and the machine:

    1) User says "dial phone number"
    2) System changes from the main Grammar to the dialing grammar (a grammar where the only rule is (1|2|3|4|5|6|7|8|9|0) repeated infinitely).
    3) User says the desired number
    4) System changes back to the main grammar.

    I implemented the steps 2) and 4) in this way:

        cmd_ln_set_str_r(m_pConfig1,"-fsg",newGrammarPath.c_str());
        if(ps_reinit(m_pPs1,m_pConfig1) < 0)
        {
            printf("Failed to reinit main recognizer\n");
            return -1;
        }
    

    The problem is that these steps take too much time, especially for languages where the acoustic model is big (i.e. en_US). Since all I do is just changing the "-fsg", how could I speed up these reinitialization? Could I skip some steps which take a lot like the reading of mixture gaussian parameter?
    Thanks in advance

     
    • Nickolay V. Shmyrev

      It is much faster to add two searches and switch between them with ps_set_search:

      https://cmusphinx.github.io/wiki/tutorialpocketsphinx/#searches

       
      • Angela

        Angela - 2020-03-18

        Hello Nickolay, is there similar approach fpr the Sphinx4 also?

         
        • Nickolay V. Shmyrev

           
          • Angela

            Angela - 2020-03-18

            Its very bad news, i wrote my bachelor thesis with Sphinx4, just need some more features. And vosk-api does not work on windows, right?

             
            • Nickolay V. Shmyrev

              It does

               

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.