JSGF Action Tags Demos |
These demos provide examples of using the edu.cmu.sphinx.tools.tags package to do post-processing of RuleParse objects obtained from JSGF grammars.
NOTE that neither one of these demos actually performs recognition - they merely show you how to use the action tags parsers once you get a recognition result.
The first demo, FeatureValueDemo, provides an example of how to embed feature/value pair logic into a JSGF grammar using ECMAScript and then use the edu.cmu.sphinx.tools.tags.ActionTagsParser class to post-process a JSGF RuleParse to get the feature/value pairs from a recognition result.
The second demo, LiveConnectDemo, provides an example of how to embed ECMAScript logic into JSGF grammars that will cause objects in your application to be activated when a JSGF RuleParse is processed by the edu.cmu.sphinx.tools.tags.ObjectTagsParser.
An example of running the LiveConnectDemo is as follows:
sphinx4>java bin/LiveConnectDemo.jar Utterance: I want a pizza with mushrooms and onions Order: pizza with mushrooms and onions. Utterance: Mushroom pizza Order: pizza with mushroom. Utterance: Sausage and pepperoni pizza Order: pizza with sausage and pepperoni. Utterance: I would like a pizza Order: plain pizza. Utterance: I want a cheese and mushroom pizza with onions Order: pizza with cheese, mushroom and onions. Utterance: I would like a burger Order: plain burger. Utterance: I would like a burger with pickles onions lettuce and cheese Order: burger with pickles, onions, lettuce and cheese. Utterance: I would like a burger with special sauce lettuce and cheese Order: burger with lettuce, cheese and special sauce. Utterance: I want a pizza with pepperoni and cheese Order: pizza with pepperoni and cheese. Utterance: Cheeseburger with onions Order: burger with cheese and onions.
Check if the bin
directory already has the
LiveConnectDemo.jar
and
FeatureValueDemo.jar
files. If not, type the
following in the top level directory:
ant -find demo.xml
First make sure that you have JSAPI setup correctly. Then, to run the demo, type:
sphinx4> java -jar bin/FeatureValueDemo.jar
or
sphinx4> java -jar bin/LiveConnectDemo.jar
NOTE:
lib/sphinx4.jar
is built. If not, go to the top level
directory and type: ant