I have written an application in Java that utlizes the CloudGarden API to parse JSAPI grammars, return tags from the grammar rules and then process these tags accordingly. The issue with the CloudGarden API is its dependency on Windows. I need a cross-platform library that can perform the same task. I do not need speech synthesis nor do I need speech recognition. Essentially a string is passed to the program containing some transcribed speech. I need to parse this string against my grammar files to retrieve the action tags (the text between { } in a JSGF grammar rule). My program then uses the retrieved action tags to perform other functions.
I have been looking for a free library that can parse JSGF grammar files that conform to JSAPI. The only realistic alternative I found was the speech recognition engine, Sphinx/CMUSphinx. I have been looking into Sphinx which brought me to the ActionTagsParser class in their documentation. I cannot figure out how to parse a grammar and retrieve the tags. Can anyone point me in the right direction or explain it to me?
Thank you, Noah
EDIT:
Does Sphinx need to be configured for the grammars to be parsed? In the following code, RuleParse always evaluates to NULL. The RuleGrammar and text are valid.
try {
if(recognizer == null){
recognizer = new BaseRecognizer();
recognizer.allocate();
}
rg.setEnabled(true);
recognizer.commitChanges();
RuleParse p = rg.parse(text, null);
if (p == null) {
return null;
}
return p.getTags();
} catch (Exception ex) {
ex.printStackTrace();
return null;
}