VoiceXML Developer Series: A Tour Through VoiceXML, Part II
The <choice> elements in the example above contain words. The choice is matched when the VoiceXML system recognizes one of the words (red, blue, or yellow). We've also added the <enumerate /> element, which will synthesize the contents of the choices. So the user will hear:
What is your favorite color? red, blue, yellow.
The previous example only contains single word grammars, but menus may contain multiple words and phrases. The interpreter will match any combination of the phrase or words in the order that they occur. For example, the menu below contains two words each. The first choice would be matched if the user said place or order or place order.
<vxml version="1.0"> <form id="form1"> <block name="block1"> <prompt bargein="true" timeout="5" >Welcome to franks flute factory.</prompt> <goto next="#menu" /> </block> </form> <menu id="menu" dtmf="true" scope="document"> <prompt bargein="true">Would you like to place an order, check order status, or talk to an operator?</prompt> <choice next="#orders">place order</choice> <choice next="#check">check status</choice> <choice next="#operator">talk operator</choice> <catch event="noinput nomatch error"> Sorry, I did'nt understand. <reprompt /> </catch> </menu>
When considering the words to include in the grammar for each choice, you should follow a few rules. First, no word should occur in more than one choice. Second, avoid using words that *sound* similar. These are words that contain similar or identical phonemes (or the sounds that make up speech). For example, if one choice contained the word mow and another choice contained more, the speech recognition software will have a hard time differentiating between the two. Use a synonym for more such as additional.
Technically, VoiceXML menus can be created very rapidly. Functionally, your users will be familiar with the mechanics of menus, because they are very similar to the majority of IVR applications that are in existance today.
A few other closing thoughts on menus. Include an id attribute in the <menu> element in cases where you want to be able to link to it from other sections or VoiceXML documents. Also, the scope attribute, if set to document, will turn on the menu grammars for the entire VoiceXML document. This technique can be use to create a global menu for the document. Include the menu in your root VoiceXML document to make the menu available to multiple VoiceXML documents.
Lastly, don't forget to try out the new live Voice Web site for VoiceXML Planet. It's sparse right now, but it does include the big VoiceXML example contained in the last article. Thanks for coming back. Let's keep talking and listening in the next edition of the VoiceXML Developer.
About Jonathan Eisenzopf
Jonathan is a member of the Ferrum Group, LLC based in Reston, Virginia that specializes in Voice Web consulting and training. He has also written articles for other online and print publications including WebReference.com and WDVL.com. Feel free to send an email to email@example.com regarding questions or comments about the VoiceXML Developer series, or for more information about training and consulting services.
Page 2 of 2