CSE 134A Discussion section
TA: Joe Drish
Date: 11/09/2001

 

Basic Course and Project Information

The midterms are almost graded; they will be available by next Wednesday, 11/14. There were some complaints about the grading for the second project. Please review the criteria on the website. Here is a summary of the basic problems, so you can do even better for project 3:

User interface 

1.  Do not use frames

2.  Please keep the interface as simple as possible

Code 

1.  Maintain well-organized code, with only relevant files in your directory

2.  Please have comment headers atop every file, and atop important functions

Report 

1.  Emphasize technical decisions. For example, why is your update policy sensible?

2.  Do have a well-organized document

3.  Use simple words and construct easy to understand sentences

 

VoiceXML Revisited

Review of last week’s VoiceXML example:

<?xml version="1.0"?>
<vxml version="2.0">
    <form>
        <field name="grade" type="boolean">
            <prompt>Would you like to get a good grade?</prompt>
            <filled>
                <submit next="goodgrade.php"/>
            </filled>
        </field>
    </form>
</vxml>
And this PHP document would process the output from the above VoiceXML document:
<?php header("Content-type: text/xml");
print('<?xml version="1.0"?>'); ?>
<vxml version="2.0">
    <form>
        <block>Your answer was
            <?php if ($grade == "true") { echo "yes"; } else { echo "no"; } ?>
        </block>
    </form>
</vxml>
Of course, your entire interface could be written in PHP that outputs VoiceXML.
 

The Go To Function

The goto function in VoiceXML is used to skip from one form to another.
This example is taken directly from the tellme tutorial, located at:
http://www.webreference.com/perl/tutorial/20/tutorial20.html
<?xml version="1.0"?>
<vxml version="1.0">
  <form id="hello">
    <block>Hello World!
   <goto next="#jack"/>
    </block>
  </form>
  <form id="mud">
    <block>My name is mud.</block>
  </form>
  <form id="jack">
    <block>My name is Jack.</block>
  </form>
</vxml>
If you demo the example on 800-555-tell, you will hear the following: Tellme: Hello World, my name is Jack.

 

Grammars: An Example

The following example  is taken from:
http://www.webreference.com/perl/tutorial/21/tutorial21.html
A grammar is a set of expressions that define what DTMF tones and spoken input will be recognized by the system. These grammars are limited to what you program them to recognize.  A simple grammar that provides the users with the option to open one of  three doors:
 

<grammar><![CDATA[         

[           
[dtmf-1] {<option "door1">}           

[dtmf-2] {<option "door2">}

[dtmf-3] {<option "door3">}         

]       
]]>   
</grammar>
 

This  will only accept DTMF input.  The user can select 1, 2, or 3, which corresponds with one of the three doors.  An example user session follows:

 

 

Tellme: You are in a small room with three doors.

Tellme: To open the first door, press 1.

Tellme: To open the second door, press 2.

Tellme: To open the third door, press 3.

User: (pressed 1)

 

Tellme: You see a large hungry monkey.

Here is the code:

 

<?xml version="1.0"?>

<vxml version="1.0">
   <form>
     <field name="answer">
       <grammar><![CDATA[
          [
            [dtmf-1] {<option "door1">}
            [dtmf-2] {<option "door2">}
            [dtmf-3] {<option "door3">}
          ]        

]]>

 

      </grammar>
       <prompt><audio>You are in a small room with three doors.</audio>
      <pause>300</pause> <audio>To open the first door, press 1.</audio>
              <pause>300</pause> <audio>To open the second door, press 2.</audio>
              <pause>300</pause> <audio>To open the third door, press 3.</audio> </prompt>
                   </field>     <filled>
                       <result name="door1">
                             <audio>You see a large hungry monkey.</audio>
                         <reprompt/>
                               </result>
                               <result name="door2">
                                 <audio>You see another room with three doors, a man, and his monkey.</audio>
                            <reprompt/>
                                   </result>      

                             <result name="door3">

                             <audio>You see a man scratching his monkey.</audio>

                      <reprompt/>
                         </result>
                    </filled>
                </form>
             </vxml>  
 



Written 11/2/2001 by Joe Drish (jdrish@cs.ucsd.edu)