Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#293 Sphinx 4 JSGF grammar should notify user of impossible rul

sphinx4 (76)
Nathan Glenn

I modified the HelloWorld example slightly to use a different grammar and then print several sentence from the grammar using JSGFGrammar.dumpRandomSentences(path,number). My grammar, however, had a faulty rule that looks something like this:

<myRule> = <myRule>;

Where if this grammar node were traversed there would be no way to to get to end node of an utterance. Loading and using the grammar in Sphinx4 works as expected (though I think a warning is needed), basically ignoring the rule because it is impossible to use it. However, if a bad grammar rule like this is present, it can cause an ArrayIndexOutOfBounds exception on line 287 of Grammar.java when using dumpRandomSentences(). I think there should be a try-catch statement around line 244 of the same file to print something about the nature of the problem.


  • Hey Nathan,

    Interesting point, would you mind to send out a sample of the faulty grammar?