Exercise 11.3
Design and implement a VoiceXML application for measuring performance data for the pizza application developed in exercise 8-3.
A. Determine what performance data is needed for this application
In order to measure word error rate, someone must listen to what the user says and transcribe it. Instead, we will use a weaker form of performance measure that can be completely automated by simply measuring if the system understood one of the prompt words. In effect, this is a measure of both the system and the user.
| Caller Task | Measure | Typical Criteria | Calculation |
| The caller speaks one
of “small, medium, large” to the prompt “what size?” |
System understands the words “small, medium, large” | More than 95% of the time | (number of times size was understood)/
(number of times size was understood + number of times size was |
| The caller speaks one
of “coke, pepsi, diet pepsi, lemonade, water” in response to “what |
System understands the words “coke, pepsi, diet pepsi, lemonade, water” |
More than 95% of the time | (number of times drink was understood)/
(number of times drink was understood + number of times drink was not understood) |
| The caller confirms that the drink order is correct | The system
says “yes” in response to “is that correct?” |
More than 95% of the time | (number of times user said yes)/(number of times user said yes + number of times user said no) |
| Caller orders a drink | Time taken to order drink | Average of (timestamp of end of order – timestamp of beginning of order) |
B. Modify the VoiceXML application to create a log file containing start and stop times required to calculate the performance data needed for this application.
<?xml version="1.0"?>
<!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
"http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
<vxml version="2.0" xmlns = "http://www.w3.org/2001/vxml">
<!-- exercise 11.3 measure performance data -->
<!-- declare variables to be sharred between VoiceXML and script -->
<var name="time_stamp1"/>
<var name="time_stamp2"/>
<var name="order_time"/>
<script>
<![CDATA[
var drink_size = new Array();
var drink_content = new Array();
// set listindex
var drink_list_index = 0;
var output_list_index = 0;
]]>
</script>
<form id="get_drink">
<script>
<!-- get timestamp at beginning of ordering a drink -->
var d=new Date();
var time_stamp1=Date.parse(d);
</script>
<field name = "current_drink_size">
<prompt>
Drink size: <break/> small, medium, or large?
</prompt>
<grammar type="application/grammar+xml" root = "drink_glass">
<rule id = "drink_glass" scope = "public">
<one-of>
<item> small </item>
<item> medium </item>
<item> large </item>
</one-of>
</rule>
</grammar>
<catch event = "noinput help nomatch">
<log label = "1">size NOT understood</log>
<reprompt/>
</catch>
</field>
<block>
<log label = "2">size understood</log>
</block>
<field name = "current_drink_content">
<prompt> Which drink? <break/> coke, pepsi, dietpepsi, lemonade, water? </prompt>
<grammar type="application/grammar+xml" root = "drink_kind">
<rule id = "drink_kind" scope = "public">
<one-of>
<item> coke </item>
<item> pepsi </item>
<item> dietpepsi </item>
<item> lemonade </item>
<item> water </item>
</one-of>
</rule>
</grammar>
<catch event = "noinput help nomatch">
<log label = "3">drink NOT understood</log>
<reprompt/>
</catch>
</field>
<filled>
<script>
<!-- get timestamp of end or ordering a drink -->
var d=new Date();
time_stamp2=Date.parse(d);
<!-- calculate time to order dring -->
order_time = time_stamp2 - time_stamp1;
</script>
<log label = "99"><value expr="order_time"/></log>
<log label = "4">drink understood</log>
<script>
<![CDATA[
drink_size[drink_list_index] = current_drink_size;
drink_content[drink_list_index] = current_drink_content;
drink_list_index = drink_list_index + 1;
]]>
</script>
<goto next="#another_drink"/>
</filled>
</form>
<form id="another_drink">
<field name="more">
<prompt>do you want another drink? </prompt>
<grammar type = "application/grammar+xml" root = "yes_no">
<rule id = "yes_no" scope = "public">
<one-of>
<item> yes </item>
<item> no </item>
</one-of>
</rule>
</grammar>
<catch event = "noinput help nomatch">
<log label = "5">confirmation NOT understood</log>
<reprompt/>
</catch>
<filled>
<log label = "6">confirmation understood</log>
<if cond = "more == 'yes'">
<goto next="#get_drink"/>
</if>
<prompt>
Here is your order
</prompt>
<goto next="#navchoice"/>
</filled>
</field>
</form>
<form id="navchoice">
<block>
<prompt>
<value expr="drink_size [output_list_index] "/>
<value expr = "drink_content [output_list_index] "/>
</prompt>
</block>
<block>
<script>
<![CDATA[
output_list_index++;
]]>
</script>
<if cond = "output_list_index < drink_list_index" >
<goto next="#navchoice"/>
</if>
</block>
<field>
<prompt>
is this correct?
</prompt>
<grammar type = "application/grammar+xml" root = "yes_no2">
<rule id = "yes_no2" scope = "public">
<one-of>
<item> yes </item>
<item> no </item>
</one-of>
</rule>
</grammar>
<catch event = "noinput help nomatch">
<log label = "7">user did NOT confirm order</log>
<reprompt/>
</catch>
<filled>
<log label = "8">user confirmed order</log>
</filled>
</field>
</form>
</vxml>
C. Create an application that reads the log file and calculates the performance data. You may use any programming language, scripting language, or even a spreadsheet application for this purpose
Return to the Instructor’s Page
![[del.icio.us]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/digg.png)
![[Google]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/linkedin.png)
![[StumbleUpon]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Windows Live]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.larson-tech.com/james/wp-content/plugins/bookmarkify/email.png)
