VoiceXML 2.1 Development Guide Home  |  Frameset Home

  SRGS-SISR: Grammar Slots  |  TOC  |  SRGS-SISR: Subgrammars  

XML Multislot Grammars

In many IVR applications of moderate-to-difficult complexity, the developer needs the ability to populate multiple variable values from but a single utterance. For instance, one might want to present associated information from a captured utterance result to the caller without the caller actually querying the IVR system. A real-world example of how this would be useful might be:

As you can see, knowing how to author such a grammar is a very useful, if not required skill for grammar developers. One can do this by using a GSL-formatted grammar quite easily due to its exceptionally lightweight syntax, but the drawback of using GSL is that it is a vendor proprietary format, which will soon be deprecated entirely by all IVR providers. As such, developers who intend for their applications to have a lenghty life-cycle should consider authoring grammar content in the slightly-more-verbose, but W3C-compliant SRGS format, and use SISR-formatted interpretation returns.

Adding additional slots to a return when using SISR is actually quite easy: We simply  create new variable-value assignments within the return tag using the below format:


<item>
  utterance value
  <tag>
    out.slotname_1="interpretation value 1";
    out.slotname_2="interpretation value 2";

  </tag>
</item>


We then access these slot values within the VoiceXML dialog by using the syntax that one would use for any slot-defined grammar:


lastresult$.interpretation.[slotname]


To better illustrate these concepts, we present a fully fleshed out grammar, and dialog, both of which can be downloaded, tested and then edited to fit your own customized content:

XMLMultislotGrammar.xml


<?xml version= "1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root = "MCCARTHY">

  <rule id="MCCARTHY" scope="public">
    <one-of lang-list="en-US">

      <item>
      the orchard keeper
          <tag> out.title="The Orchard Keeper"; out.year="1965"; </tag>
      </item>

      <item>
        outer dark
          <tag> out.title="Outer Dark"; out.year="1968"; </tag>
      </item>

      <item>
      child of god
          <tag> out.title="Child of God"; out.year="1974"; </tag>
      </item>

      <item>
      suttree
          <tag> out.title="Suttree"; out.year="1979"; </tag>
      </item>

      <item>
        blood meridian
          <tag> out.title="Blood Meridian: Or the Evening Redness in the West"; out.year="1985"; </tag>
      </item>
      <item>
      all the pretty horses
          <tag> out.title="All the Pretty Horses"; out.year="1992"; </tag>
      </item>

      <item>
      the crossing
          <tag> out.title="The Crossing"; out.year="1994"; </tag>
      </item>

      <item>
      cities of the plain
          <tag> out.title="Cities of the Plain"; out.year="1998"; </tag>
      </item>

      <item>
      no country for old men
          <tag> out.title="No Country for Old Men"; out.year="2005"; </tag>
      </item>

      <item>
      the road
          <tag> out.title="The Road"; out.year="2006"; </tag>
      </item>

  </one-of>
    </rule>
</grammar>



Utterance Slot= 'title' Slot= 'year'
blood meridian out.title="Blood Meridian: Or the Evening Redness in the West"; out.year="1985";


And what about the invoking VoiceXML code, you ask? Look no further:

SISR_Multislot.xml


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

  <form id="MainForm">
    <field name="F_1">

    <grammar src="XMLMultiSlotGrammar.xml" type="application/grammar-xml"/>

    <prompt>
    What is your favorite novel by Cormac McCarthy?
    </prompt>

    <filled>
    <prompt>
      <value expr="lastresult$.interpretation.title"/>,
      is an exceptional piece of literature, and was well received by readers, critics,
      and Pee Wee Herman when it was originally released in
      <value expr="lastresult$.interpretation.year"/>.
    </prompt>

    <log expr="'*** INTERPRETATION RESULT = ' + lastresult$.interpretation.title"/>
    <log expr="'*** INTERPRETATION RESULT = ' + lastresult$.interpretation.year"/>

    </filled>

    </field>
  </form>

</vxml>


Download the Code!

  Download the source code




  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  SRGS-SISR: Grammar Slots  |  TOC  |  SRGS-SISR: Subgrammars  

© 2013 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site