VoiceXML 2.1 Development Guide Home  |  Frameset Home

  SRGS-SISR: Built-in Grammars  |  TOC  |  SRGS-SISR: Multislot Grammars  

XML Slot-defined Grammars

Defining a specific slot value for an XML grammar based on the Speech Recognition Grammar Specification is just as easy as when doing it with the older, non-W3C-compliant GSL format. An example of a GSL grammar with slots explicitly defined looks like this:

MYRULE    [
[cheddar]                                {<MySlot "cheddar cheese">}
(monteray jack)                    {<MySlot "jack cheese">}
(stinky french cheese)        {<MySlot "stinky cheese">}
                ]



When we want to achieve the same thing with SRGS grammars using the W3C-compliant SISR syntax, we simply specify the slot definition via an "out.[slotname]" variable definition, and define the value to what we want returned as the interpretation:


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

      <rule id="MYRULE">
        <one-of>
          <item> cheddar <tag>out.MySlot="cheddar cheese";</tag> </item>
          <item> monteray jack <tag>out.MySlot="jack cheese";</tag> </item>
          <item> stinky french cheese <tag>out.MySlot="stinky cheese";</tag> </item>
        </one-of>
      </rule>
    </grammar>


So, when a user utters 'cheddar' the returned interpretation value will be 'cheddar cheese' when we access the lastresult$:


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

  <form id="Queso">
    <field name="F_1" slot="MySlot">

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

    <prompt>
    What is your favorite kind of cheese?
    </prompt>

    <filled namelist="F_1$.interpretation.MySlot">
    <prompt>
      you said that your favorite cheese is
      <break/>
      <value expr="lastresult$.interpretation.MySlot"/>
    </prompt>
    <log expr="'*** INTERPRETATION RESULT = ' + lastresult$.interpretation.MySlot"/>
    </filled>

    </field>
  </form>
</vxml>



Download the Code!

  Download the source code




  ACCOUNT LOGIN
Username:  
Password:  
  You must login with your Voxeo developer account prior to posting or editing your existing posts. If you aren't a member of Voxeo's developer community, click here to register.
  ANNOTATIONS: EXISTING POSTS
Khamyl
7/10/2006 5:17 PM (EDT)
Hi,
Two examples above are not equal if we consider the optional and repeat operator in GSL format. Are they?

How should grXML formated grammar look like if we want it to be equivalent with GSL format considering operators.

Thank you.
Khamyl
MattHenry
7/10/2006 5:29 PM (EDT)


Hello Khamyl,

You are indeed correct. Apologies if this slight misrepresentation caused any confusion. I'll see that this is corrected in the next Build of the VXML docs.

~Matthew Henry
lily
12/26/2007 1:24 PM (EST)
I used the converter to convert the gsl grammar to the grXML one. The way to get the slots are really different, in the beginning they create a function to be able to get the slots. Is there an easier way like in the gsl one?

When I used the example you provided for the grXML it didn't work out.

Thanks!
VoxeoTony
12/26/2007 10:05 PM (EST)
Hello,

You spoke of a converter, unfortunately, I'm not entirely sure of what converter you are referring to in your posting.  We do also see that you are looking to continue the process of getting the grXML grammar slot functionality to work.

We would want to know more information about this tutorial not working for you.  It was tested stringently prior to being published on the tutorials page.  In addition, I ran a follow up test to be sure it was operational.  However, this doesn't mean that you aren't experiencing issues.  We would like to offer you the opportunity to create an account ticket under your account in order for us to help troubleshoot this issue with you.  Having the account ticket open will allow you to send us the logging data that would be paramount in our discovery efforts without compromising personal information.



Cheers,

Tony
sambhav
1/23/2010 2:50 PM (EST)
Hello everyone

I should say, a great place to learn VXML.

I am newbie and exploring about VXML.

I have query about grammar specifications.
what is difference when we use grxml, ABNF form and JSGF?pros and cons?

are latter two deprecated?

Thanks :-)
VoxeoBrian
1/23/2010 3:13 PM (EST)
Hello,

Glad to hear you are making strides to learn VoiceXML and you are finding our documentation and environment helpful in this process...

When it comes to grammar formats, GRXML(SRGS) grammars are the most common specificaiton compliant grammar in todays IVR development space.  ABNF grammars and JSGF are still valid specification compliant grammars however they are not very common, and the majority of recognizers in the space today have done away support for them.

Having said all that, Prophecy(our platform software) employs a grammar translator that ensures that all grammar formats are supported by the platform, so, GSL, JSGF, ABNF will work without issue.

As far as a recommendation is concerned I would utilize SRGS with SISR return syntax as this is the most common specification compliant grammar available today.

Hope this helps.

Regards,

Brian F.
erelsgl
6/21/2012 12:17 PM (EDT)
Thanks for all the useful information!

I need some clarification:

In the grammar line "<tag>out.MySlot="cheddar cheese";</tag>"

do I have to use the same slot name "MySlot" as in the vxml line "<field name="F_1" slot="MySlot">"?

What happens if I omit the slot name in the "field" tag - will I still be able to use it in the line "<value expr="lastresult$.interpretation.MySlot"/>"?

xshao
6/30/2012 3:03 AM (EDT)
Hi,

Whatever name you use in the <field> tag, you'll reference it in lastresult$.interpretation.[that field name].

Hope this helps. Thanks.

Xudong

  SRGS-SISR: Built-in Grammars  |  TOC  |  SRGS-SISR: Multislot Grammars  

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