Menu

add JSGF rules in pocketsphinx

Help
Vincent
2011-07-27
2012-09-22
  • Vincent

    Vincent - 2011-07-27

    Hi all,

    Is it possible to add/change JSGF rules at runtime in pocketsphinx? In Sphinx
    4 it can be done like this:

    jsgfGrammar.loadJSGF("music");
    RuleGrammar ruleGrammar = new BaseRuleGrammar(jsapiRecognizer,
    jsgfGrammar.getRuleGrammar());
    addRule(ruleGrammar, "song1", "listen to over the rainbow");
    addRule(ruleGrammar, "song2", "listen to as time goes by");
    addRule(ruleGrammar, "song3", "listen to singing in the rain");
    ...

    How to do this in pocketsphinx?

     
  • Nickolay V. Shmyrev

    Hello

    Pocketsphinx doesn't maintain JSGF as is but converts JSGF to FSG grammar
    immediately.You can operate on FSG grammar using fsg_model.h API, for example
    with fsg_model_trans_add function and then commit the changes with
    ps_update_fsgset. But it's not that simple as addRule, you need to figure out
    node ids in FSG grammar.

     

Log in to post a comment.