At run time we are populating a list of files and folders. I want to add that list in the Gram file. I really have no idea how to change the gram file and load it again. I have gone through sphinx JSGF but because the lack of time I am not able to read it completely.
I am using sphinx4-1.0beta6 version.
Here are the steps involved for changing grammar at runtime:
Get the JSGFGrammr component. the JSGFDemo constructor shows how the JSGFGrammar component (called the jsgfGrammarManager in the demo) can be retrieved from the ConfigurationManager:
Use the JSGFGrammar component to load new JSGF Grammars - The new JSGF gramamrs can be loaded via the loadJSGF method. An example of how this is done can be found in the 'loadAndRecognize' method.
Add new rules using a RuleGrammar - a JSGF grammar can be manipulated directly from Java code. Rules can be added, enabled and disabled for your application. The methods 'loadAndRecognizeMusic' and 'addRule' demonstrate how your application can add new rules. Here's the 'addRule' method that shows how a new rule can be added to a ruleGrammar.
You can see these resources:
2
If you want to change in your gram file then you need to add them in dictionary file acoustic model.