VoiceXML
VoiceXML — Voice
Extensible Markup Language — is a
W3C recommendation
designed for creating audio dialogs.
Its features include:
Its major goal is to bring the advantages of Web-based development and content delivery to interactive voice response applications.[W3C]
A VoiceXML document contains a set of dialogs. Each dialog can be either a form or a menu.
Example:
A minimal VoiceXML script for a form with a single field.
User is prompted, and the response is then repeated back.
<form> <field name="transporttype"> <prompt> Please choose airline, hotel, or rental car. </prompt> <grammar type="application/x=nuance-gsl"> [airline hotel "rental car"] </grammar> </field> <block> <prompt> You have chosen <value expr="transporttype">. </prompt> </block> </form>
Example: A VoiceXML script for a form with 3 fields, which confirms each field and handles the noinput and nomatch situations.
<noinput> I'm sorry, I didn't hear you. <reprompt/> </noinput> <nomatch> I'm sorry, I didn't understand that. <reprompt/> </nomatch> <form> <block> Welcome to the air travel consultant. </block> <field name="origin"> <prompt> Which city do you want to leave from? </prompt> <grammar type="application/x=nuance-gsl"> [(san francisco) denver (new york) barcelona] </grammar> <filled> <prompt> OK, from <value expr="origin"> </prompt> </filled> </field> <field name="destination"> <prompt> And which city do you want to go to? </prompt> <grammar type="application/x=nuance-gsl"> [(san francisco) denver (new york) barcelona] </grammar> <filled> <prompt> OK, to <value expr="destination"> </prompt> </filled> </field> <field name="departdate" type="date"> <prompt> And what date do you want to leave? </prompt> <filled> <prompt> OK, on <value expr="departdate"> </prompt> </filled> </field> <block> <prompt> OK, I have you are departing from <value expr="origin"> to <value expr="destination"> on <value expr="departdate"> </prompt> send the info to book a flight... </block> </form>
Consider the field with the name departdate. VoiceXML 2.0 specifies seven built-in grammar types — boolean, currency, date, digits, number, phone, and time. Since the type of this field is date, a data-specific language model (grammar) will be automatically passed to the speech recognizer, so the grammar does not need to be explicitly specified.
Example: An example which shows mixed initiative. In a mixed initiative dialogue, users can choose not to answer the question that was asked by the system. For example, they might answer a different question, or use a long sentence to fill in multiple slots at once. This means that the VoiceXML interpreter can no longer just evaluate each field of the form in order; it needs to skip fields.
The grammar allows sentences which specify the origin or destination cities or both. User can respond to the initial prompt by specifying origin city, destination city, or both. whose values are set. This is done by a guard condition, a test that keeps a field from being visited. The default guard condition for a field tests to see if the field's form item variable has a value, and if so the field is not interpreted.
The grammar is a CFG grammar with two rewrite rules, named Flight and City. The Nuance GSL grammar formalism uses parentheses () to mean concatenation and square brackets [] to mean disjunction. [Thus a rule like the "wanna" rule, can be expanded as i want to fly or i want to go, and "airports" can be expanded as san francisco or denver. (sic)]
<noinput> I'm sorry, I didn't hear you. <reprompt/> </noinput>
<nomatch> I'm sorry, I didn't understand that. <reprompt/> </nomatch>
<form>
<grammar type="application/x=nuance-gsl">
<![ CDATA[
Flight ( ?[
(i [wanna (want to)] [fly go])
(i'd like to [fly go])
([(i wanna)(i'd like a)] flight)
]
[
( [from leaving departing] City:x) {<origin $x>}
( [(?going to)(arriving in)] City:x) {<destination $x>}
( [from leaving departing] City:x
[(?going to)(arriving in)] City:y) {<origin $x> <destination $y>}
]
?please
)
City [ [(san francisco) (s f o)] {return( "san francisco, california")}
[(denver) (d e n)] {return( "denver, colorado")}
[(seattle) (s t x)] {return( "seattle, washington")}
]
]]> </grammar>
<initial name="init">
<prompt> Welcome to the air travel consultant. What are your travel plans? </prompt>
</initial>
<field name="origin">
<prompt> Which city do you want to leave from? </prompt>
<filled>
<prompt> OK, from <value expr="origin"> </prompt>
</filled>
</field>
<field name="destination">
<prompt> And which city do you want to go to? </prompt>
<filled>
<prompt> OK, to <value expr="destination"> </prompt>
</filled>
</field>
<block>
<prompt> OK, I have you are departing from <value expr="origin">
to <value expr="destination">. </prompt>
send the info to book a flight...
</block>
</form>