|
Developing Multimodal Applications using XHTML+Voice
Continued from previous page...
size.jsgf
grammar pizza_size;
public = small|medium|large ; |
5 -- Voice part of a multimodal applicationFigure
What vegetable toppings would you like?
<vxml:grammar src="vegtoppings.jsgf"/>
For example, say mushrooms and peppers.
expr="vtoppingsvegetable"/>
|
Figure 6 -- How to specify an external grammer
External Speech Grammar Files
External speech grammar files are used to define specific selections. For example, the vegetable toppings for the form are in the vegtoppings.jsgf file and the meat toppings are in the meattoppings.jsgf file. These grammar files are shown in Figures 7, 8 and 9.
vegtoppings.jsgf
grammar vegitable_toppings;
= olives | mushrooms | onions | peppers;
public =
{
this.$value="";
}
( [and]{
this.$value = this.$value + " " + $veggies;
})+; |
Figure 7 -- Grammars for vegetable toppings
onetotwenty.jsgf
grammar one_twenty;
public = 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20 ; |
Figure 8 -- Grammars for number choice of 1-20
meattoppings.jsgf
grammar meat_toppings;
= bacon | chicken | ham | meatball | sausage | pepperoni;
public =
{
this.$value="";
}
( [and]{
this.$value = this.$value + " " + $meats;
})+; |
Figure 9 -- Grammars for meat toppings
Phonetic Representations
The application also needs the phonetic pronunciations for the words in the grammar. The pizza.pbs file contains the words and their phonetic representations.
pizza.pbs
small
medium
large
yes
no
and
olives
mushrooms
onions
peppers
bacon
chicken
ham
meatball
sausage
sausage
pepperoni
|
S M AO L
M IY D IY AH M
L AA R JH
Y EH S
N OW
AX N DD
AA L IH V Z
M AH SH R UW M Z
AH N Y AH N Z
P EH P ER Z
B EY K AH N
CH IH K AH N
HH AE M
M IY T B AO L
S AO S AH JH
S AO S IH JH
P EH P ER OW N IY |
Figure 10 -- pizza.pbs phonetic representations file
Processing Part
The Processing Part of the application contains the code that is used to perform the needed instructions for each of the various events. This section also contains the event handlers. For example, the quantity of pizzas ordered requires the event handlers shown in Figure 11.
Figure 11 --Processing part
Continued...
back to the top
Copyright © 2001-2003 VoiceXML Forum. All rights reserved.
The VoiceXML Forum is a program of the
IEEE Industry Standards and Technology Organization (IEEE-ISTO).
|