Voxeo Documentation - Universal Grammars

GSL syntax is not considered to be a W3C-compliant syntax for grammars , and the Nuance has discontinued support for GSL grammars in their most recent product offerings. Voxeo will continue to support GSL-specific markup for some time to come, but it is suggested that new applications and their associated grammars leverage the SRGS + SISR grammar syntaxes instead of being reliant upon the deprecated GSL grammar format.

The Universal Grammar feature lets developers take advantage of predefined grammars and responses to catch and handle common voice commands within the VoiceXML application. These grammars need to be specifically enabled to the developer to include them into the application, by way of the W3C universals property, otherwise the grammars are ignored. Grammars other than help and exit will need <catch> sections as they do not have any built-in feature other than being a short hand grammar. The included utterances for Universal events are:

 

help

 
 

cancel

 
 

exit

 
 

repeat

 

There are also two additional values for using all or none of the preceding grammars:

 

all

 
 

none

 

To enable a Universal Grammar in an application, you can place the following code at the <vxml> level of your root document.

All enables the help, cancel, exit and repeat grammars

<property name="universals" value="all"/>

None disables all universal grammars

<property name="universals" value="none"/>

Help will enable the help grammar. When a user says help, your application will move execution to the <help> elements within your current form. For example:

<field name="helpfield">

<help>

  You said help!

</help>

</field>

Exit will terminate the application when the user says exit. No additional programming needed.

Cancel and Repeat will both require a <catch> to function correctly. When a user says cancel or repeat the application will look for a <catch> with the event attribute set to either cancel or repeat. For example:

<catch event="cancel">

<prompt>

  You said cancel!

</prompt>

</catch>

Or for repeat:

<field name="options_field">

<catch event="repeat">

  <reprompt />

</catch>

</field>

If these predefined grammars do not do exactly what you want, you can simply define your own universal grammar using the <link> element to handle these user utterances. To customize your event processing for these occurrences, keep in mind that you must assign <catch> elements in your script to handle the event, else the default handlers and audio files are executed.

Here is an example of how to use the <link> element:

<link event="custom">

<grammar type="text/gsl">

  <![CDATA[

   [custom]

  ]]>

</grammar>

</link>

<catch event="custom">

<prompt>

  YAY you caught the custom grammar event!

</prompt>

</catch>

I'm sure by this point you are anxious to see an example of all this nifty stuff in action. Well, you are in luck!

<?xml version="1.0" encoding="UTF-8"?>

<vxml version="2.1">

 

<!-- Set the universals property to the grammars we want to use -->

<!-- remember this can be global, field level or both -->

<!-- help uses the <help> element -->

<!-- repeat and cancel require a <catch> to correctly execute -->

<!-- exit will automatically exit the application when the caller says "exit" -->

<!-- Universals can also be set to all and none for "help repeat exit cancel" or disabled respectively -->

 

<property name="universals" value="help cancel exit repeat" />

 

<!-- Set up a link-type global grammar -->

<!-- This is essentially what a universal grammar is -->

<link event="global">

 

  <grammar type="text/gsl">

   <![CDATA[

    [global]

   ]]>

  </grammar>

 

</link>

 

<!-- Set up our main form and field -->

<form id="frm_main">

  <field name="main_menu">

 

   <!-- This is our local field-level grammar that we would use for

    field specific options -->

   <grammar type="text/gsl">

    <![CDATA[

     [

      [( one )]

      [( two )]

      [( three )]

     ]

    ]]>

   </grammar>

 

   <!-- Start the main menu TTS -->

   <prompt>

    Welcome to the main menu

    Please choose one of the following options

    Say one two or three for the local grammar

    Say help for help

    Say repeat to repeat these options

    Say cancel to cancel

    Say exit to disconnect

   </prompt>

 

   <!-- An utterance from our field level grammar was recorded -->

   <filled>

    <prompt>

     You are in filled

     The utterance was <value expr="lastresult$.utterance" />

    </prompt>

 

    <!-- restart this form so we can try again -->

    <goto next="#frm_main" />

   </filled>

 

   <!-- The help universal will always look for the <help> elements -->

   <!-- when a help element is found the execution will continue here -->

   <help>

    <prompt>

     YAY you asked for help so I give you cheese burger

    </prompt>

   </help>

 

   <!-- Set up a catch for the repeat universal grammar -->

   <catch event="repeat">

    <prompt>

     I found a repeat event

    </prompt>

 

    <!-- Do what repeat does, repeat the prompt! -->

    <reprompt />

   </catch>

 

   <!-- Set up a catch for the cancel universal grammar -->

   <catch event="cancel">

    <prompt>

     This is cancel, canceling the thing you wanted to cancel

    </prompt>

   </catch>

  </field>

</form>

 

<!-- set up a global catch for our link global grammar -->

<catch event="global">

  <prompt>

   YAY we are in the custom global grammar catch!

  </prompt>

</catch>

</vxml>

Downloadable Sample Code

See Also

GSL Grammars Overview

Voxeo Support

 

An Internet standards organization responsible for many of the standards key to the functionality of the World Wide Web today. The acronym for World Wide Web Consortium is W3C. The W3C is working on voice expansions to access web content. For more information, see The Voice Browser Working Group.

 

The set of valid utterances recognized by the speech recognition system in a voice application. Grammars are commonly specified using symbolic notation which describes context-free grammars.

 
Voxeo Corporation is a technology company that specializes in providing development platforms for unified customer experience as self-service and unified communications using real-time communications applications. Voxeo's products are also available as a SaaS platform as cloud-based services using on-premise software in a private cloud, or hybrid clouds that combine both on-demand public-cloud and on-premise components. For more information, see Voxeo.com.

 
VoiceXML is an XML markup language format that you can use to specify interactive voice dialogs between a human and a computer. A voice application developed using VoiceXML can be deployed in a similar way an HTML application is deployed. While HTML uses a visual browser to display data, VoiceXML uses a voice browser, for example, the Voxeo Prophecy VoiceXML browser, to interpret the VoiceXML data. For more information, see the VoiceXML 2.1 Development Guide.
 

The <catch> element is used to intercept application and user-defined errors, conditions, and messages, allowing the developer to assign event handlers on a scoped basis. For more information, see <catch> Element.

 
In an IVR application, an utterance is a unit of speech of the caller, usually collected in response to a prompt, which the automatic speech recognition system attempts to match against a grammar.
 

The <vxml> element is the initial declaration that defines a document as a VoiceXML application. For more information, see <vxml> Element.

 

The <help> element is shorthand for the <catch event="help"> element, and catches all help events. For more information, see <help> Element.

 

The <catch> element is used to intercept application and user-defined errors, conditions, and messages, allowing the developer to assign event handlers on a scoped basis. For more information, see <catch> Element.

 

The <catch> element is used to intercept application and user-defined errors, conditions, and messages, allowing the developer to assign event handlers on a scoped basis. For more information, see <catch> Element.

 

The <link> element allows the developer to implement a document or application scoped grammar and transition or event handler for caller input. For more information, see <link> Element.

 

The <catch> element is used to intercept application and user-defined errors, conditions, and messages, allowing the developer to assign event handlers on a scoped basis. For more information, see <catch> Element.

 

The <link> element allows the developer to implement a document or application scoped grammar and transition or event handler for caller input. For more information, see <link> Element.

Voxeo Documentation

     Voxeo Documentation Overview
  Evolution Developer Portal Documentation
  Voxeo CXP Documentation
  Prophecy Documentation
  XML Development Languages Documentation
  VoiceXML 2.1 Development Guide
     VoiceXML Development Guide v2.1 Overview
     Platform Overview
     Creating an Application
     Voxeo File Manager
     Caching Tips and Techniques
     Cache Manager API
     Security Information
  Learning VoiceXML 2.1
  Best Practices
  Debugging Techniques
  Exceptions and Errors
  VoiceXML 2.1 Porting Guide
  VoiceXML Variables
  All Things Audio
  Outbound Dialing
  Property Guide
  GSL Grammars
     GSL Grammars Overview
     GSL Basics
     GSL Grammar Hints
     Universal Grammars
     GSL Grammar Slots
     DTMF Grammars in the GSL Format
     GSL Built-in Grammar Types
     Multi-Slot GSL Grammars
     Grammar Weighting and Probability
     External GSL Subgrammars
     Inline GSL Subgrammars
     Downloadable GSL Subgrammar Library
     GSL Multislot Subgrammars
  grXML Grammars
     Custom Features
     External References
  Text-To-Speech Guide
     VoIP Dialing
     Voxeo Designer User Interface
  Element Reference Guide
     Element Summary
     <assign> Element
     <audio> Element
     <block> Element
     <break> Element
     <catch> Element
     <choice> Element
     <clear> Element
     <data> Element
     <disconnect> Element
     <else> Element
     <elseif> Element
     <emphasis> Element
     <enumerate> Element
     <error> Element
     <example> Element
     <exit> Element
     <field> Element
     <filled> Element
     <foreach> Element
     <form> Element
     <goto> Element
     <grammar> Element
     <help> Element
     <if> Element
     <initial> Element
     <item> Element
     <link> Element
     <log> Element
     <mark> Element
     <media> Element
     <menu> Element
     <meta> Element
     <noinput> Element
     <nomatch> Element
     <one-of> Element
     <option> Element
     <paragraph> Element
     <param> Element
     <phoneme> Element
     <prompt> Element
     <property> Element
     <prosody> Element
     <record> Element
     <reprompt> Element
     <return> Element
     <rule> Element
     <ruleref> Element
     <say-as> Element
     <script> Element
     <sentence> Element
     <sub> Element
     <subdialog> Element
     <submit> Element
     <tag> Element
     <throw> Element
     <token> Element
     <transfer> Element
     <value> Element
     <var> Element
     <voxeo:logcontrol> Element
     <voxeo:recordcall> Element
     <vxml> Element
  CCXML 1.0 Development Guide
  CallXML 3.0 Development Guide
  Voxeo Support
     Support Quick Reference
  Registering for an Account
  Self-Help Tools
  Collecting Information
  Evolution Ticketing System
     Submitting a Support Request
     Escalating a Support Request
  Software Lifecycle and Support Policies
  Getting Further Assistance
  Voxeo Glossary
  Help on Help