JSGF Grammars and Action Tags
Willie, our fearless leader in the Speech Group here in Sun Labs, just added support for ECMAScript action tags to Sphinx-4. With Action Tags the parsing of recognition results can be greatly simplified. This is similar to Semantic Interpretation work done by the W3C as part of the VoiceXML effort.
Here's a JSGF grammar that shows how you could use action tags to support a fast food restaurant.
<pizzaTopping> = cheese | pepperoni | mushrooms | mushroom | onions | onion | sausage; <pizza> = <NULL> { this.$value = new Packages.demo.jsapi.tags.Pizza(); } ([and] <pizzaTopping> { this.$value.addTopping($); })* (pizza | pie) [with] ([and] <pizzaTopping> { this.$value.addTopping($); })*; // Burger toppings and command. // <burgerTopping> = onions | pickles | tomatoes | lettuce | cheese; <burgerCondiment> = mayo | relish | ketchup | mustard | special sauce; <burger> = ((burger | hamburger) { this.$value = new Packages.demo.jsapi.tags.Burger(); } | cheeseburger { this.$value = new Packages.demo.jsapi.tags.Burger(); this.$value.addTopping("cheese")}) [with] ( [and] ( <burgerTopping> { this.$value.addTopping($); } | <burgerCondiment> { this.$value.addCondiment($); } ) )*; public <order> = [I (want | would like) a] (<pizza> | <burger> { appObj.submitOrder($.$value); };With this grammar you can say things like:
"I want a pizza with pepperoni and onions and sausage and mushrooms' "I would like a cheeseburger with relish, onions and special sauce"
and the proper Java objects (Burger or Pizza) will be created with all of the proper toppings, and condiments. This eliminates a whole level of parsing that would have to be done in the Java code. You can read more about Action Tags here: ECMAScript Action Tags for JSGF
Posted by Alexander on September 14, 2004 at 03:56 PM EDT #