-
Notifications
You must be signed in to change notification settings - Fork 1
/
hw1_q3.xml
103 lines (90 loc) · 2.65 KB
/
hw1_q3.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?xml version="1.0"?>
<vxml version = "2.1">
<meta name="maintainer" content="[email protected]" />
<property name="grammarfetchint" value="prefetch" />
<property name="universals" value="help cancel exit repeat" />
<form id="Main">
<field name="Option">
<prompt>
Please choose from the following options.
Pick one for in order utterance, and two,
for all at once single utterance
</prompt>
<!-- Define the grammar. -->
<grammar xml:lang="en-us" root = "myrule">
<rule id="myrule">
<one-of>
<item> One </item>
<item> Two </item>
</one-of>
</rule>
</grammar>
</field>
<!-- Checks the options -->
<filled namelist="Option">
<if cond="Option == 'One'">
<goto next="hw1_q2.xml" />
<elseif cond="Option == 'Two'" />
<goto next="#Single"/>
<else/>
<prompt>
It's neither options!
</prompt>
</if>
</filled>
</form>
<form id="Single">
<field name="F_1">
<prompt>
Please listen to the following options.
Please tell us your city, state and follow by one,
for the current weather, two, for short term, and three, for the long term.
</prompt>
<grammar xml:lang="en-US" root = "TOPLEVEL">
<rule id="TOPLEVEL" scope="public">
<item>
<!-- CITY -->
<item repeat="0-1">
<ruleref uri="#CITY" />
<tag>out.citySlot=rules.CITY.citySubsSlot</tag>
</item>
<!-- STATE-->
<item repeat="0-1">
<ruleref uri="#STATE" />
<tag>out.stateSlot=rules.STATE.stateSubsSlot</tag>
</item>
<!-- WEATHER -->
<ruleref uri="#WEATHER" />
<tag>out.weatherSlot=rules.WEATHER.weatherSubsSlot</tag>
</item>
<!-- TOP LEVEL RETURN-->
<tag> out.F_1 = out.citySlot + "," + out.stateSlot + out.weatherSlot </tag>
</rule>
<rule id="CITY" scope="public">
<one-of>
<item> seattle <tag>out.citySubsSlot="seattle";</tag></item>
<item> san diego <tag>out.citySubsSlot="san diego";</tag></item>
</one-of>
</rule>
<rule id="STATE" scope="public">
<one-of>
<item> washington <tag>out.stateSubsSlot="washington";</tag></item>
<item> california <tag>out.stateSubsSlot="california";</tag></item>
</one-of>
</rule>
<rule id="WEATHER" scope="public">
<one-of>
<item> one <tag> out.weatherSubsSlot=" is currently sunny "; </tag></item>
<item> two <tag> out.weatherSubsSlot=" will be rainy "; </tag></item>
<item> three <tag> out.weatherSubsSlot=" will mainly be rainy "; </tag></item>
</one-of>
</rule>
</grammar>
<filled>
<prompt>
The weather in <value expr="F_1" />
</prompt>
</filled>
</field>
</form>
</vxml>