VoiceXML 2.1 Development Guide Home  |  Frameset Home


<grammar>  element


The grammar element allows the developer to specify a GSL or XML recognition grammar for either voice or DTMF input.  Grammars may be defined inline (within the vxml document itself), or as a standalone, external file. For further information, see the GSL grammar Appendix and the grXML Grammar Appendix.



usage

<grammar fetchhint="(prefetch|safe)" fetchtimeout="CDATA" mode="(dtmf|voice)" root="IDREF" scope="(dialog|document)" src="string - URI" srcexpr="CDATA" tag-format="CDATA" type="(application/grammar-xml|text/gsl)" version="1.0" voxeo:useuri="(true|false)" weight="CDATA" xml:base="CDATA" xml:lang="NMTOKEN" xmlns="http://www.w3.org/2001/06/grammar">


attributes

fetchhint Data Type: (prefetch|safe) Default: safe
Fetchhint is used to specify when the resource should be fetched during application execution. The possible values and their descriptions are:
  • prefetch : Begin the resource fetch upon initial document execution
  • safe: Only fetch the resource when it is specifically called in the application

Note that the Voxeo platform will always *not* prefetch content by default. As such, a developer should specify a value of ''prefetch" if resources are to be made available prior to execution of application content.
fetchtimeout Data Type: CDATA Default: 5s
(Ignored attribute)
The ‘fetchtimeout’ attribute is used to indicate how long, (in seconds or milliseconds), the interpreter should attempt to fetch the content before throwing an error.badfetch exception.
mode Data Type: (dtmf|voice) Default: voice
The mode attribute specifies the mode of the grammar in question. The two values allowed for this attribute are 'voice' and 'dtmf'.
root Data Type: IDREF Default: Optional
XML Grammars only
The root attribute defines the root rulename of the XML grammar, and is required for any inline XML grammar construct.
scope Data Type: (dialog|document) Default: Optional
The scope attribute allows the developer to specify whether the grammar will be given dialog scope or document scope. Document scoped grammars must have slotnames and return values explicitly defined in order to function properly. See the grammar documentation for additional information. If a value for this attribute is not specified, then the grammar inherits the scope of its parent element. Note that specifying a grammar 'scope' within a form-item, (such as the <field> element), will cause a fatal error.
src Data Type: string - URI Default: Optional
The src attribute specifies the target URI of the grammar file. External GSL grammars referenced with the src attribute must have a pound sign and rulename appended to the end of the URI:

<grammar src=”MyGrammar.gsl#MyRuleName” type="text/gsl"/>

Inline grammars are not subject to this syntax, nor do they need an explicit src declared:


<grammar type="text/gsl">[chupacabra]</grammar>

However, inline GSL subgrammars need not referenece anything at all in the src attribute. However, the top-level rule must be prefixed by a 'period':

<grammar type="text/gsl">
        <![CDATA[
        .FULLNAME
        [NAME:d {<person_by_full_name $d>}]

        NAME
        (FIRSTNAME:a ?MIDDLENAME:b LASTNAME:c)
        {return(strcat($a strcat($b $c)))}

        FIRSTNAME
        [[matthew] {return("matthew ")}]

        MIDDLENAME
        [[warren]  {return("warren ")}]

        LASTNAME
        [[henry]  {return("henry ")}]
                        ]]>
      </grammar>


Also note that inline grammars that define slot values must be enclosed within CDATA blocks, else the application will throw a fatal error.badfetch.
srcexpr Data Type: CDATA Default: Optional
The srcexpr attribute evaluates to an ECMAScript value that defines the target URI. Either srcexpr or src may be specified for the element, but not both.
tag-format Data Type: CDATA Default: semantics/1.0
The tag-format attribute allows the developer to specify the grammar tag format of an inline XML grammar construct. The only valid data type for this optional element is 'semantics/1.0'.
type Data Type: (application/grammar-xml|text/gsl) Default: Required
The type attribute specifies the MIME type of the grammar file. Acceptable values for this attribute are 'application/grammar-xml' or 'text/gsl'. Note that unlike other voice browsers, this attribute is required in order to effectively implement a voice grammar. If left unspecified, then an error.badfetch will occur.
version Data Type: 1.0 Default: 1.0
The version attribute of the grammar element, predictably enough, specifies the version of the grammar itself. This should always be set to '1.0'.
voxeo:useuri Data Type: (true|false) Default: Optional (true)
The voxeo:useuri attribute is used to bypass the Prophecy grammar translator and send the URI for a grammar directly to an external recognizer, such as Nuance, or Loquendo. The external recognizer fetches and compiles the grammar itself. To bypass the Prophecy grammar translator, place this attribute directly in the grammar XML element. This attribute is useful for large grammars that can be compiled and cached by an external recognizer.

Note: As this attribute is a Voxeo-specific extension, you must specify the xmlns:voxeo within the vxml element with the value set to the Voxeo namespace, for example, xmlns:voxeo="http://community.voxeo.com/xmlns/vxml".
weight Data Type: CDATA Default: Optional
XML Grammars only
The weight attribute specifies the increased or decreased likelihood for a particular grammar match. For instance, specifying the value as 0.8' would increase the chances that an approximate utterance would be considered a valid grammar match, while a value of '0.2' would make it highly unlikely that a match would ever be considered valid.
xml:base Data Type: CDATA Default: Optional
The URI value of the xml:base attribute denotes the base URL of the document. All relative URI’s contained in the document are derived from the base attributes value. If unspecified, then the platform assumes that the current URI is the value of the base attribute.
xml:lang Data Type: NMTOKEN Default: Required
The xml:lang attribute specifies the language and locale information of the grammar If omitted in GSL grammars, it will inherit this value from the document hierarchy, or ultimately from the platform default, which equates to 'en-US'. The language and locale information is not case-sensitive. Note: This attribute is required when using XML grammars.

For VoiceXML language options and mappings, see ASR Languages and TTS Languages.
xmlns Data Type: http://www.w3.org/2001/06/grammar Default: Required
The xmlns attribute defines the grXML namespace; all tags and attributes belong to this namespace. This attribute is required when using grXML grammars, and should specify the value of "http://www.w3.org/2001/06/grammar"



shadow variables

none


parents

<choice>   <field>   <form>   <link>   <record>   <transfer>


children

<rule>


code samples

<Grammar xml:lang-version-type-mode> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

  <form id="F1">

  <field name="F_1">

  <prompt> 
    What are the chances of the Michael Moore making an unbiased, relevant documentary movie in his lifetime? 
    </prompt>
 
    <grammar xml:lang="en-US" version="1.0" type="text/gsl" mode="voice">
        [(not a chance)]
    </grammar>

  </field>

  <filled>
    <prompt>
    I would have to agree with you, sir!
    </prompt>
  </filled>

</form>

</vxml>


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

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1" scope="document">

    <grammar scope="document" type="text/gsl">
      <![CDATA[

      .MYRULE
      [
      [(david hasselhoff)] {<MySlot "dave">}
      ]
      ]]>
        </grammar>

  <!-- the utterance of 'david hasselhoff' anywhere in the
  application will fill this namelist-->

      <filled namelist="MySlot">
        <goto next="#F3"/>
      </filled>

    <field name="F_1">

      <grammar type="text/gsl">[(moe green)]</grammar>
      <prompt>
        Who should get the next crack at playing Hamlet ?
        His initials are d h .
      </prompt>


      </field>

      <filled namelist="F_1">
        <prompt>
          You said <value expr="F_1"/> Are you insane?
        </prompt>
        <goto next="#F2"/>
      </filled>
<!-- this empty field matching
        the form grammar's slot is required
-->

  <field name="MySlot"/>

  </form>

  <form id="F2" scope="dialog">
    <field name="F_2">
    <grammar type="text/gsl">[(george jones)]</grammar>
    <prompt> 
      Who is the biggest celebrity in germany?
    </prompt>

      <filled>
        <prompt>
          now thats just crazy talk.
        </prompt>
      </filled>
    </field>

<!-- this empty field matching
        the form grammar's slot is required
-->

    <field name="MySlot"/>


  </form>

  <form id="F3">
    <block>
      <prompt>
        Our form level grammar has been filled.
      </prompt>
    </block>
  </form>

</vxml> 




additional links

W3C 2.0 Specification
W3C SRGS 1.0 Specification
Nuance Grammar Guide


  ANNOTATIONS: EXISTING POSTS
moshe
6/7/2004 4:30 PM (EDT)
In the description of the attribute "expr," the text says:

"The expr attribute evaluates to an ECMAScript value that defines the target URI. Either expr or next may be specified for the element, but not both."

There is no attribute "next" -- this is a typo, just ignore it.
MattHenry
6/7/2004 4:49 PM (EDT)
Moshe,


I got this typo fixed in the recent Build, which will be posted by the end of the week; this should read as:

"The expr attribute evaluates to an ECMAScript value that defines the target URI. Either expr or *src* may be specified for the element, but not both".

Thanks for the catch!

~Matt
anujsharma
7/19/2004 5:18 AM (EDT)
Again a little typo!

The word *both* is still missing...
awirtz
1/26/2005 8:44 PM (EST)
If you need to track down XML syntax errors in a grXML document, you might try adding the following DOCTYPE element and using an XML validator:

<!DOCTYPE grammar SYSTEM "http://www.w3.org/TR/speech-grammar/grammar.dtd">

This tag should be placed after the <?xml?> tag and before the <grammar> tag in your document.  There is a publicly available XML validator here:

http://www.stg.brown.edu/service/xmlvalid/
safarishane
8/18/2005 6:22 PM (EDT)
It seems that what attributes are *really* required and *really* optional depend on if the grammar is used inline or not.
moshe
8/22/2005 11:13 AM (EDT)
Eloy, would you please post details -- which elements are required, and which elements are optional, if it's used inline or not?

And remember, folks -- as each release of the VoiceXML interpreter comes out, things will change. With any luck, some of our comments about discrepencies will become obsolete.
safarishane
10/25/2005 3:40 PM (EDT)
Wondering if the option "both" is allowed for the grammar attribute of mode, or if you can actually put both in there.

<grammar mode="voice dtmf"....../>
<grammar mode="both"....../>

Or, do you *have* to have seperate grammars?
steve.sax
10/25/2005 3:49 PM (EDT)
Hiya Shane,

Technically, we can use dtmf and voice entries in a SRGS grammar without specifying a 'mode' at all. However, this isn't really considered Compliant behavior. To wit, check out our most execllent code samples at the below link, which illustrates this point in greater detail:

http://docs.voxeo.com/voicexml/2.0/grxml_dtmf.htm

Steve Sax
Asier
11/24/2005 3:52 AM (EST)
Hello there,

is there a way for use a dynamic uri for a grammar?? My platform not support vxml 2.1.

Thanks in Advance,
Asier
MattHenry
11/24/2005 10:38 AM (EST)

Hello Asier,

If you are stating that you are using a VXML platform that does not support the 2.1 specification, and as such, does not support the 'srcexpr' attribute, then you might well have a good reason to switch to Voxeo. The only alternative that I see for specifying a dynamic grammar URI would be to set this on the server side, using ASP/JSP/etc.


~Matt

rnayar
7/15/2007 10:29 AM (EDT)
Hi,
I have a grammar containing long & complex text. the text is normally 4-5 words longs & words are mix of easy & complex.
I am facing lots of difficulty in speech recognition.
I am using XMl grammar format. with confidencelevel as low as 30%.
Please help, its really urgent..

appreciate ur help

thanks u so much!!!!
voxeojeff
7/15/2007 3:20 PM (EDT)
Hello there,

In order to be of further assistance, we will need you to send us debugger logs illustrating the error you are receiving with your grammar.  Also, sending us the XML output of your application, along with the grammar will help in case we need to make a test case.  Once you've sent us this information, we can go ahead and create a private account ticket for you.

Best regards,

Jeff Menkel
Voxeo Corporation
Magician
7/24/2007 11:23 AM (EDT)
Greetings....

Is there support on the Voxeo platform for "built-in" grammars? I'm working through some DTMF field entry requirements. Are there other solutions other than specifying a list of the "dtmf-?" values within a specific grammar?

Thanks for your help.

Magician
voxeojeff
7/24/2007 2:01 PM (EDT)
Hello Magician,

I've managed to pull an answer out of a hat for you, so to speak. :-)  Voxeo does indeed support certain built-in grammars.

http://docs.voxeo.com/voicexml/2.0/gslbuiltins.htm

If you're looking for one which supports dtmf input, I would suggest the built-in digits grammar, which is detailed in the link above.

Hope this helps!

Jeff Menkel
Voxeo Corporation
annuvinayak
6/4/2008 5:37 AM (EDT)
Hi,

I have used grammar tag to specify the appropriate input for a field tag. But when some characters other then the ones specified in the grammar(i.e. *) are used, the application does not indicate any problem and passes the number to the next level as shown:

<field name="userTelNo" type="number">
<grammar type="text/gsl">
[dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-7 dtmf-8 dtmf-9 dtmf-0]
</grammar>
<prompt>
Please enter your 10 digit telephone number
</prompt>
<filled>
<if cond="userTelNo.length != 10">
<goto next="#invalidLength" />
</if>
<var name="telephoneNumber" expr="userTelNo" />
<var name="password" expr="'-1'" />
<submit next="" namelist="telephoneNumber password" />
</filled>
</field>

What do i do to specify that only certain digits should be entered and if some other digits are entered then an error message is thrown?

Regards,
Annu
voxeojeremyr
6/4/2008 10:56 AM (EDT)
Hi Annu,

Yes, you certainly can do that.  In the current grammar you gave an example of, all the digits would be valid input.  An asterisk should fail and the pound sign, is normally set as a keystroke terminator.  (This can be changed with a <property> tag.  i.e. http://docs.voxeo.com/voicexml/2.0/w3cprops.htm#start)

You can catch out of grammar utterance or keypresses with a <catch event="nomatch"> or the shorthand version <nomatch>.  More information on that can be found here:
http://docs.voxeo.com/voicexml/2.0/catch.htm
http://docs.voxeo.com/voicexml/2.0/nomatch.htm

I hope this helps and happy coding.

Thanks,
Jeremy Richmond
Voxeo Support
annuvinayak
6/5/2008 4:41 AM (EDT)
Thanks for your reply Jeremy. I had used nomatch for this functionality before but somehow it slipped my mind this time. Your post helped me out :)

Also I would like to take this opportunity to say Thanks to the entire support team that you have out there. You guys are doing a great job with your quick and apt responses for all sorts of queries.

Thanks again for your help.

Regards,
Annu
annuvinayak
6/5/2008 10:59 AM (EDT)
Hi,

I tried using nomatch with the previous post as shown:

<field name="userTelNo" type="number">
<grammar type="text/gsl">
[dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-7 dtmf-8 dtmf-9 dtmf-0]
</grammar>
<prompt>
Please enter your 10 digit telephone number
</prompt>
<filled>

<nomatch>
<prompt>
Is that a number? Please try again.
</prompt>
<reprompt/>
</nomatch>

<if cond="userTelNo.length != 10">
<goto next="#invalidLength" />
</if>
<var name="telephoneNumber" expr="userTelNo" />
<var name="password" expr="'-1'" />
<submit next="" namelist="telephoneNumber password" />
</filled>
</field>

Now If I enter * as the first digit, the control goes to the nomatch loop, but if I enter some digits and then enter * then the control flows as if all correct digits were entered. Why this discrepancy?

Also I tried this
<field name="userTelNo" type="digits">
i.e. changed the type of field to digits. Now as soon as i enter * (even after entering other digits) the nomatch block is played.

It solved my purpose a bit, but not completely, I want that the 10 digit number should be taken as input and if any of its characters is not a digit(between 0 and 9) then it should play the nomatch block. Would I have to do that explicitly or do we have support for this?

Thanks in advance.

Cheers!
Annu
VoxeoDustin
6/5/2008 11:09 AM (EDT)
Hey Annu,

The digits built-in should serve your purpose, and you can simplify your application by using the length property of it. This grammar will also except both dtmf and voice input, so you won't need the inline grammar:

<field name="userTelNo" type="digits?length=10">
  <prompt>
    Please enter your 10 digit telephone number
  </prompt>

  <nomatch>
  <prompt>
    Is that a number? Please try again.
  </prompt>
    <reprompt/>
  </nomatch>

<filled>
  <var name="telephoneNumber" expr="userTelNo" />
  <var name="password" expr="'-1'" />
<submit next="" namelist="telephoneNumber password" />
</filled>
</field>

Let me know if you have any further questions.

Cheers,
Dustin
jefo12
6/18/2008 12:11 PM (EDT)
To request an appointment this week you can say today,tomorrow ,day after tomorrow or a specific day such as this Friday.you can also request the day next week such as next Friday.


<grammar type="text.gsl">
[today tomorrow dayaftertommorrow Sunday Monday Tuesday Wednesday Thursday Friday Saturday (next Sunday) (next Monday) (next Tuesday) (next Wednesday) (next Thursday) (next Friday) (next Saturday) morning afternoon evening (next appointment)]
</grammar

THE USER CAN SELECTS ANY ONE OF THE ABOVE OR HE CAN SELECT A SPECIFIC DATE SUCH AS MARCH 2ND...
HOW CAN I WRITE GRAMMAR FOR THIS PLZ SUGGEST...

PLZ GIVE ME THE VXML CODE...

voxeojohnq
6/18/2008 12:48 PM (EDT)
Hello,

It appears have already addressed this question in a private account ticket under your account "jefo12".  If you have any additional questions, please refer to the existing ticket for all of your additional inquiries relating to this issue.

Thanks,
John Quinn
Voxeo Support
jefo12
6/20/2008 12:50 AM (EDT)
<grammar type="text.gsl">
[today tomorrow (day after tomorrow) (?next Sunday) (?next Monday) (?next Tuesday) (?next Wednesday) (?next Thursday) (?next Friday) (?next Saturday) ]
</grammar>


To request an appointment this week you can say today, tomorrow ,day after tomorrow or a specific day such as this Friday.you can also request the day next week such as next Friday.plz make ur request now Such as today,tomorrow,day after tomorrow,this Friday or next Friday.

For a specific date, say date.
how should i include the grammar for date...user can also say the specific date 2nd march then how can i include that..
can i write two grammar files?.

plz give me suuggestion...
jefo12
6/20/2008 7:30 AM (EDT)

<field name="abc" type="date">
<grammar type="text.gsl">
[today tomorrow (day after tomorrow) (?next Sunday) (?next Monday) (?next Tuesday) (?next Wednesday) (?next Thursday) (?next Friday) (?next Saturday) ]
</grammar>


i want to take both date and days
can i include both builtin grammar and inline grammar like this....
plz suggest
VoxeoDustin
6/20/2008 9:39 AM (EDT)
Hey Jefo,

You can, in fact, use both built-in and inline/external grammars with VoiceXML, however only one of them will match. You may want to use the SRGS grammar I provided you before as it will allow you to match both the day and the date in the same utterance. I've reattached that grammar here in case you did not get it the first time.

Thanks,
Dustin
jefo12
6/20/2008 9:46 PM (EDT)
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">

<form id="welcome">

<field name="Phone" type="number" mode="dtmf">

  <prompt> Please enter your phone number  </prompt>

<filled>
     
<prompt> ok got it you said
          <value expr="phone"/>
    </prompt>
</filled>
</field>
</form>
</vxml>

This code is not executed it is saying some internal error...can uplz tell me why?>
voxeodamonic
6/20/2008 10:11 PM (EDT)
Hi Jefo,

I'll be happy to assist you with looking into this error.  Please allow me some time test the application and try to replicate the error in which you are experiencing.  Hopefully, we can identify why we are having a problem.  I'll update you shortly with my findings.

Thanks,

Damonic
Voxeo Support
voxeodamonic
6/20/2008 10:56 PM (EDT)
Hello,

Upon reviewing your code I've noticed a possible error within the <field> element.  You'll notice that you are using the following:

<field name="Phone" type="number" mode="dtmf">

The mode attribute is not a valid component of the <field> element.  The proper attribute that I believe you may have confused this for is the "modal" attribute.

The modal attribute is a fine tuning control for grammars within the field element.  When the modal attribute is set to false(default value) all higher scoped grammars are activated.  If set to true then only grammars within the field are activated and all other grammars are temporarily disengaged or disabled.

You may find more on this subject in our online docs at the following URL:
http://docs.voxeo.com/voicexml/2.0/field.htm

In order to allow for dtmf functionality you would utilize something like this:

  <form id="guessNumber">
    <field name="guess">
    <grammar type="text/gsl">
        [one two three four five six seven eight nine zero]
      </grammar>
    <grammar type="text/gsl">
      [dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-6 dtmf-7 dtmf-8 dtmf-9 dtmf-0]
    </grammar>

    <prompt>
      Guess what the computer is thinking! Pick a number between 0 and 9.
    </prompt>
    .
    .
    .

You can also find more about DTMF functionality at the following online documentation:
http://docs.voxeo.com/voicexml/2.0/t_8.htm

Best regards,

Damonic
Voxeo Support
jefo12
6/21/2008 12:07 PM (EDT)
Thank u for your help damonic,
here i'm facing another problem regarding the callerid validations....
i'm attaching my code here....please give me your suggestion otherwise give me a reference tutorial for that.. i'll be very much pleased if u do this favour...

<vxml>
<var name="callerid" expr="session.callerid">
<form id="welcome">
<block>
<if cond="callerid.length==10&,&amp;callerid!='restricted'&,&amp;callerid!='unknown'">
<field name="enterphone" type=digits?length=10">
<prompt>
welcome plz enter your phone no.</prompt>
<filled>
<subdialog name="checkapp" src="checkapponitment.jsp" namelist="enterphone/">
<prompt> you have the appointments on  (".....")so and so date
</prompt>
</filled>
</field>
</form>

1) An error occurs at if condition...dont know why it is?.
another important one i would like to know is....
2) if we submit this phone no to checkappointment.jsp from that send  it to database retrieve the appointments of that phone no from database and we hav to store appointments in an array in jsp.

                my question is how to store that date and timings in an array..suppose if the user has an appointment on 25th march at 10:30 how to store that in an array in checkappointment.jsp....suppose lets assume that we store that in a array.Is it possible to receive the array which is having appointment timings from jsp to the subdialog "checkapp"...

after receiving from jsp to subdialog how can i prompt all these appointments  to the user...





MattHenry
6/21/2008 2:21 PM (EDT)


Hello Jefo,

Your questions on the topic of the <if> element are being addressed in the account ticket that you opened for it, but regarding the question on how to store arrays in the JSP context is best left for JSP specific sites:

http://forum.java.sun.com/thread.jspa?threadID=580629&messageID=2941191

As to how you may read them back in the VoiceXML context, you may want to take a look at the <foreach> element:

http://docs.voxeo.com/voicexml/2.0/foreach.htm

~Matt
jefo12
6/24/2008 1:49 AM (EDT)
how to enable dynamic grammar using dtmf...



<prompt> The appointments are </prompt>


          <foreach item="applist" array="myarr">
            <prompt><value expr="applist"/><break/></prompt>
        </foreach>

//palys all the appointments the callerid has.....

<prompt> Do you want to cancelorreschedule any of those appointments say cancel or
    reschedule or
    if you want to take an new appointment say schedule..
</prompt>
If the user selects cancel...then
<prompt>To cancel any of the appointments press the corresponding dtmf button to cancel </prompt>
//how can i do this dynamiclaly....

plz suggest me.....

voxeojohnq
6/24/2008 9:06 AM (EDT)
Hey jefo,

In order to create a dynamic grammar, you must generate it using server side programming.  We have an excellent tutorial on how to create these grammars in our VoiceXML documentation.  You can read it here: http://docs.voxeo.com/voicexml/2.0/frame.jsp?page=t_16.htm  If after reading this, you still have questions, please don't hesitate to ask.

Regards,

John Quinn
Voxeo Support
archdave
7/15/2008 6:56 AM (EDT)
hello,
i'm having a small problem trying a starter vxml script. When I call i get an error saying something about the file content having an internal error. However, i have run the xml file and it is well-formed and validates perfectly. Please see below:

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

  <form>
    <block>
      <prompt>
        Things are working correctly. Congratulations.
      </prompt>
    </block>
  </form>
</vxml>


Can u pls help me on this one? I am anxious to begin full IVR devt.
Thanks in advance.
voxeojohnq
7/15/2008 7:18 AM (EDT)
Hello,

First off, your code is 100% correct.  I took at look at your application configuration, and what I think is happening here is that the server that you hosted your VoiceXML script on is not responding.  If you goto your evolution account then open the application debugger and call your application, you will be able to see the "Fetch Timeout" error that I am talking about.  If you have any further questions, please don't hesitate to ask.

Regards,

John Quinn
Voxeo Support
jefo12
9/8/2008 4:37 AM (EDT)
Hi,

Can any one suggest me how can i use freestyle grammar.means

"I would like a coca cola and three large pizzas with pepperoni and mushrooms".

how can i recognize this.. pls give me the link.
voxeoJeffK
9/8/2008 5:04 AM (EDT)
Hi,

A situation like that is best solved with a mixed initiative dialog. We have a full tutorial on them here:

http://docs.voxeo.com/voicexml/2.0/t_20.htm?search=mixed+dialog#anchor

hope that helps,
Jeff K.
mtatum111
9/17/2008 5:35 PM (EDT)
I was presented the following question.  The answer is supposed to be B but I don't understand why the answer is not D.  Can you give any explanation?

Here is the question.
Given the following grammar named itinerary.grxml :

<grammar version = "2.0" type = "application/srgs+xml" root = "flight" >
    <rule id = "flight" >
          From <ruleref uri = "#city1"/> to <ruleref uri = "#city2"/>
    </rule>
    <rule uri = "city1" scope = "public" >
          <one-of>
              <item> Chicago </item>
              <item> Boston </item>
          </one-of>
    </rule>
    <rule uri = "city2" >
          <one-of>
              <item> Alanta </item>
              <item> Seattle </item>
          </one-of>
    </rule>
</grammar>

Which of the following are all of the legal references from within a VoiceXML application?

A. src = "itinerary.grxml"
B. src = "itinerary.grxml" and src = "itinerary.grxml#city1"
C. src = "itinerary.grxml" and src = "itinerary.grxml#city2"
D. src = "itinerary.grxml" src = "itinerary.grxml#city1" and src = "itinerary.grxml#city2"

voxeoJeffK
9/18/2008 12:29 AM (EDT)
Hi,

The key here is the scope of the city2 rule:  <rule uri = "city2" >

Since no scope has been explicitly defined it defaults to "private" which , to quote the W3C spec: "A private rule may be explicitly referenced only by other rules within the same grammar."

For answer "D" to be correct the city2 rule would need to be defined as public:

<rule uri = "city2" scope = "public">

hope that helps,
Jeff K.
mtatum111
9/18/2008 8:54 AM (EDT)
Jeff, thanks so much for the clarification. I completely looked over the scope attribute!  I think it might be time for glasses :)
jefo12
9/26/2008 11:19 AM (EDT)
Hi,

I need to have a multi-slot grammar.

For example "I would like two large pizzas with mozzarella
and one small pizza with tomatoes and anchovies".
            what will be the grammar format for this type of utterances.How can i write grammar for this.can you plz explain me with an example.

<form id="pizza">
<field name="orderpizza">
<grammar-----?>
<prompt>what do you want pls select</prompt>
---
---
</field>
</form>

Thanks,
jefo.
voxeojeremyr
9/26/2008 2:28 PM (EDT)
Hi,

I spent a couple hours writing a little application up describing who to do this.  What I did was to just take one pizza order at a time.  If you wanted to take several orders, you could ask the caller if they wanted to order more pizzas. 

Here is the grammar:
[code]
<?xml version= "1.0"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd">
<grammar mode="voice" xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" version="1.0" root="TOPLEVEL" tag-format="semantics/1.0">
<rule id="TOPLEVEL">
  <item>
  <item repeat="0-1">
    <ruleref uri="#PREFILLER"/>
  </item>
  <item>
    <ruleref uri="#NUMBER"/> <tag>out.numberslot=rules.NUMBER.numberSubSlot;</tag>
  </item>
  <item>
    <ruleref uri="#SIZE"/> <tag>out.sizeslot=rules.SIZE.sizeSubSlot;</tag>
  </item>
  <item> pizza </item>
    <item>
    <ruleref uri="#TOPPINGS"/> <tag>out.toppingsslot=rules.TOPPINGS.toppingsSubSlot;</tag>
    </item>
    <item repeat="0-1">
        with
    </item>
  </item>
 
</rule>


    <rule id="PREFILLER" scope="public">
          <one-of>
                <item> ummm </item>
                <item> I would like </item>
                <item> i think I would like </item>
                <item> how about </item>
        </one-of>
    </rule>
<rule id="NUMBER">
          <one-of>
                <item> one   
                  <tag> out.numberSubSlot="one " </tag>
                </item>
                <item> two   
                  <tag> out.numberSubSlot="two " </tag>
                </item>
                <item> three   
                  <tag> out.numberSubSlot="three " </tag>
                </item>
                <item> four 
                  <tag> out.numberSubSlot="four " </tag>
                </item>
                <item> five   
                  <tag> out.numberSubSlot="five " </tag>
                </item>
                <item> six   
                  <tag> out.numberSubSlot="six " </tag>
                </item>
            </one-of>
    </rule>
<rule id="SIZE">
          <one-of>
                <item> small   
                  <tag> out.sizeSubSlot="small " </tag>
                </item>
                <item> medium         
                  <tag> out.sizeSubSlot="medium " </tag>
                </item>
                <item> large         
                  <tag> out.sizeSubSlot="large " </tag>
                </item>     
            </one-of>
    </rule>
   
    <rule id="TOPPINGS">
      <item> 
          <item>
            <one-of>
                <item> cheese 
                  <tag> out.toppingsSubSlot= "cheese "</tag>
                </item>
                <item> pepperoni
                  <tag> out.toppingsSubSlot="pepperoni " </tag>
                </item>
                <item> onions
                  <tag> out.toppingsSubSlot="onions " </tag>
                </item>
                <item> anchovies   
                  <tag> out.toppingsSubSlot="anchovovies " </tag>
                </item>
                <item> mushrooms
                  <tag> out.toppingsSubSlot="mushrooms "</tag>
                </item>   
            </one-of>
          </item>
          <item> and </item>
          <item repeat="0-5">
            <one-of>
                <item> cheese 
                  <tag> out.toppingsSubSlot= out.toppingsSubSlot +"cheese "  </tag>
                </item>
                <item> pepperoni
                  <tag> out.toppingsSubSlot=out.toppingsSubSlot + "pepperoni " </tag>
                </item>
                <item> onions
                  <tag> out.toppingsSubSlot=out.toppingsSubSlot + "onions "</tag>
                </item>
                <item> anchovies   
                  <tag> out.toppingsSubSlot= out.toppingsSubSlot + "anchovovies " </tag>
                </item>
                <item> mushrooms
                  <tag> out.toppingsSubSlot= out.toppingsSubSlot + "mushrooms " </tag>
                </item>   
            </one-of>
          </item>
      </item>
         
           
    </rule>

</grammar>
[/code]


And here is a little vxml application that calls it:
[code]
<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.0">
<meta name="author" content="J. Richmond"/>
<meta name="copyright" content="2007 voxeo corporation"/>
<form id="multipleslots">

  <field name="Pizza">
    <grammar src="Pizza_grammar.grxml" type="application/grammar-xml" mode = "voice"/>

    <prompt>Please say a pizza.</prompt>

    <filled>
      <log expr="'Pizza is: ' + Pizza"/>
      <log expr="'Number is: ' + Pizza$.interpretation.numberslot"/>
      <log expr="'Size is: ' + Pizza$.interpretation.sizeslot"/>
      <log expr="'toppings are: ' + Pizza$.interpretation.toppingsslot"/>
     
      <prompt>

       
        You want <value expr="Pizza$.interpretation.numberslot"/> 
        <value expr="Pizza$.interpretation.sizeslot"/> with the following toppings
      <value expr="Pizza$.interpretation.toppingsslot"/>.

      </prompt>
    </filled>
  </field>

</form>
</vxml>
[/code]

Please let us know if you have any questions.

Thanks,
Jeremy Richmond
Voxeo Support


mtatum111
10/1/2008 9:58 AM (EDT)
I have been thinking about the following problem that I have been studying for my certification test.  The answer is supposed to be D- which is src = "mygrammar.grxml".  However, I don't see why the answer would not be src = "mygrammar.grxml#get_order"
Can you give some explanation.  As always, thanks for all of your help!

1. Given the following grammar stored at mygrammar.grxml :

<grammar type="application/grammar+xml" version="1.0 xml:lang = "en" root="get_order">
    <rule id = "get_order" scope = "public">
        <one-of>
              <item>
                  <item><ruleref uri = "#get_quantity"/></item>
                  <item><ruleref uri = "#get_stock"/></item>
              </item>
              <item><ruleref uri = "#get_quantity"/></item>
              <item><ruleref uri = "#get_stock"/></item>
          </one-of>
    </rule>

    <rule id = "get_quantity" scope = "public">
          <one-of>
              <item>one <tag> quantity = "1"</tag></item>
              <item>two <tag> quantity = "2" </tag></item>
              <!-- rest of grammar omitted to save space -->
        </one-of>
    </rule>

    <rule id = "get_stock" scope = "public">
          <one-of>
              <item> intel <tag>ticker_symbol = "intc" </tag> </item>
              <item> microsoft <tag>ticker_symbol = "msft" </tag> </item>
              <item> cisco <tag>ticker_symbol = "csco" </tag> </item>
          </one-of>
    </rule>
</grammar>

What should be placed in the box as the form-level grammar?

<form id = "sell_stock">
    <grammar [_____________] />
          <initial name = "start">
              <prompt> What is your sell order? </prompt>
          </initial>

    <field name = "quantity">?</field>
    <field name = "ticker_symbol">?</field>
</form>

A. src = "mygrammar.grxml#quantity"
B. src = "mygrammar.grxml#get_quantityl"
C. src = "mygrammar.grxml#get_stock"
D. src = "mygrammar.grxml"

VoxeoDustin
10/1/2008 10:34 AM (EDT)
Hey Melissa,

The root is defined as get_order in the tag, so referencing it when calling the grammar is not necessary, as this rule will be used by default.

Cheers,
Dustin
mtatum111
10/1/2008 10:43 AM (EDT)
Thanks, Dustin. I appreciate your explanantion.

Also, for the next question on grammars

How does a form-level grammar differ from a field-level grammar? I know that the answer is 1. However, I was thinking that 2 might also be the answer.  The author says that it is 1 only for the answer.  I don't understand why 2 is not an answer as well.  Can you explain why it is not the answer as well. 

1)A form-level grammar may specify values for multiple fields within a single utterance while a field-level grammar specifies values only for a single field.
2)Each value specified by a form-level grammar may be placed in each field of that form, while a value specified by a field-level grammar may only be place into that field.
3) Form-level grammars may be external while field-level grammars are always internal to the vxml document.
4) Field-level grammars are dynamic while form-level grammars are static
voxeoblehn
10/1/2008 4:24 PM (EDT)
Hello,

I do not see an issue with the latter part of answer number two, but believe the reason two is incorrect has to do with the redundancy of the value. If you are specifying a value as a form level grammar there would be no need to specify again in the field as the form level will be valid for the entire document. I am assuming this is what the author was going for, and if not, several certified support guys here may need a refresher as this is what we came up with :)

Cheers,

Brian L.
Voxeo Support
mtatum111
10/3/2008 8:30 AM (EDT)
Is it safe to say that normally form level grammars are used in conjunction with the <initial> element.  This of course, would mean that the caller can used mixed initative dialog.  In the above example I see that you have the form level grammar
form id="F1" scope="document">

    <grammar scope="document" type="text/gsl">
      <![CDATA[

      .MYRULE
      [
      [(david hasselhoff)] {<MySlot "dave">}
      ]
      ]]>
        </grammar>

  <!-- the utterance of 'david hasselhoff' anywhere in the
  application will fill this namelist-->


However, I don't see an <initial> element. 
Can you explain why in some case you would have <initial> element and other case you do not even though you have a form level grammar.

Thanks for any clarification.
mtatum111
10/3/2008 8:35 AM (EDT)
I was also a little confused by the example.
For instance,
<!-- this empty field matching
        the form grammar's slot is required
-->
  <field name="MySlot"/>

  </form>


My confusion comes in because it looks like <field> does not contain anything.

I was thinking that it would look something like the following

<field name="MySlot" modal="false">   
  <prompt>Please say your response </prompt>
</field>
*NOTE;; you don't really have to set modal="false" here because the default is "false"

voxeojeremyr
10/3/2008 9:05 AM (EDT)
Hi,

It does look a bit odd, but it is not really empty.  Because the modal attribute is set to false and there is a higher level grammar, this field can match the utterance in that higher level grammar.  Also note that you do not need a <prompt> within a <field> element.

Most of the time <fields> do have prompts in them so that we can direct the caller what to say, but there are some circumstances where you might want escalating prompts in a no input or no match scenario so in that case you would put the prompts in those event catchers and not directly in the <field> element.

Thanks,
Jeremy Richmond
Voxeo Support
mtatum111
10/3/2008 9:39 AM (EDT)
Jeremy, thanks for the info.  Did you also have a chance to look at my other question - no rush- just wanted to make you aware in case you might have overlooked it.  Again, thanks for all of your help.

Is it safe to say that normally form level grammars are used in conjunction with the <initial> element.  This of course, would mean that the caller can used mixed initative dialog.  In the above example I see that you have the form level grammar
form id="F1" scope="document">

    <grammar scope="document" type="text/gsl">
      <![CDATA[

      .MYRULE
      [
      [(david hasselhoff)] {<MySlot "dave">}
      ]
      ]]>
        </grammar>

  <!-- the utterance of 'david hasselhoff' anywhere in the
  application will fill this namelist-->


However, I don't see an <initial> element. 
Can you explain why in some case you would have <initial> element and other case you do not even though you have a form level grammar.

Thanks for any clarification.
voxeojeremyr
10/3/2008 10:40 AM (EDT)
Hi Melissa,

Sorry about that, you are correct, I missed that question.  :)

There are a few different reasons why you might want to include a form level grammar, of for that matter even a document scoped grammar.  Generally the use of 'universals' is a good reason for using these level of grammars. 

For example, if you had a form that collected type of account and amount, you could have a form level grammar that included help, transfer, CSR, repeat..., etc.  It is easier to just put this grammar at the form level than for each input item.

Thanks,
Jeremy Richmond
Voxeo Support
MattHenry
10/3/2008 10:49 AM (EDT)


Hi Melissa,

To add to Jeremy's posting, it is indeed true that a form level grammar is commonly used for mixed-initiative dialogs, but the root methodology behind form-level grammars is simply for fine-grained grammar scope control. For instance, one might use a form-level grammar when we have a document that contains several forms, each of which contain multiple fields, to implement a command ("go to operator", or something similar) that is only active in a single given form, and not applicable to the entire document, or application.

And for what it is worth, we have an additional example of a mixed-init dialog over i our tech-tips blog posting on the topic of alpha-numeric grammars: Good stuff there.

=)


http://blogs.voxeo.com/voxeodeveloperscorner/

~Matthew Henry
mtatum111
10/3/2008 3:31 PM (EDT)
Matthew, thanks so much for the additional piece of information.  Y'all guys are the best in answering all of my  questions.  I really appreciate all of your insight!
jefo12
10/7/2008 6:23 AM (EDT)


Hi,

I would like to have a grammar for alphabets.Is this possible..?

I need to recognize the name spell by the user.suppose if i say the

name as  'R I C H M O N D' it should recognize.what should be the

grammar for this type of utterances...

can anyone help me out...

Thanks,
jefo.

VoxeoDustin
10/7/2008 10:13 AM (EDT)
Hey Jefo,

I must preface this by saying that alphanumeric recognition is one of the most difficult things to do accurately with voice recognition. I have attached a grammar below to get you started, but this will likely take a good deal of tweaking to get reasonably accurate.

Let me know if you have any further questions.

Thanks,
Dustin
jefo12
10/7/2008 12:19 PM (EDT)
Thanks dustin for your reply,unfortunately i did'nt find any link

regarding the grammar can u pls send it again..




Thanks,
jefo.


VoxeoDustin
10/7/2008 12:27 PM (EDT)
Hey Jefo,

I have opened a ticket in your account with the grammar attached.

Let me know if you have further questions.

Thanks,
Dustin
mtatum111
10/22/2008 9:36 AM (EDT)
If you have an inline grammar, does maxage and maxstale come into play.  I wouldn't think so since we are just using inline grammars.  Do you agree?
voxeojeremyr
10/22/2008 10:08 AM (EDT)
Hi Melissa,

Yes you are correct.  This would only apply to external grammars or more specifically where a fetch to another document has to be made.  Of course, we recommend that you do not rely on these settings as caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes.

Thanks,
Jeremy Richmond
Voxeo Support
jefo12
11/19/2008 5:49 AM (EST)


Hi,

I would like to have a grammar which returns the alphabet for the DTMF keypad (2=ABC, 3=DEF, etc.) can any one help me out to do this.


Thanks,
jefo.
voxeoJeffK
11/19/2008 7:16 AM (EST)
Hi,

If I understand you correctly then this should do it. Note that the "1" and "0" do not have letters associated with them on the keypad.

<?xml version= "1.0"?>
<grammar xml:lang="en-US" root = "TOPLEVEL" mode="dtmf">
    <rule id="TOPLEVEL" scope="public">
<one-of>
          <item> 1 <tag> <![CDATA[  <F_1 "empty"> ]]>  </tag> </item>
          <item> 2 <tag> <![CDATA[  <F_1 "ABC"> ]]>  </tag> </item>
          <item> 3 <tag> <![CDATA[  <F_1 "DEF"> ]]>  </tag> </item>
          <item> 4 <tag> <![CDATA[  <F_1 "GHI"> ]]>  </tag> </item>
          <item> 5 <tag> <![CDATA[  <F_1 "JKL"> ]]>  </tag> </item>
          <item> 6 <tag> <![CDATA[  <F_1 "MNO"> ]]>  </tag> </item>
          <item> 7 <tag> <![CDATA[  <F_1 "PQRS"> ]]>  </tag> </item>
          <item> 8 <tag> <![CDATA[  <F_1 "TUV"> ]]>  </tag> </item>
          <item> 9 <tag> <![CDATA[  <F_1 "WXYZ"> ]]>  </tag> </item>
          <item> 0 <tag> <![CDATA[  <F_1 "empty"> ]]>  </tag> </item>
        </one-of>
</rule>
</grammar>

hope that helps,
Jeff K.
vinaybtech51
12/8/2008 2:33 AM (EST)
Hi
     
    I need spelling grammar (which takes the spelling of the caller

first name or last name). Can you send me the spelling grammar ?


Thanks & Regards,
Vinay.
voxeoJeffK
12/8/2008 3:10 AM (EST)
Hi Vinay,

Attached is an alpha-numeric grammar. Spelling grammars can be difficult to get perfect, so you may need to customize it based on your particular application.

regards,
Jeff K.
Voxeo Support

<grammar xml:lang="en-us" version="1.0" xmlns="http://www.w3.org/2001/06/grammar" root="TOPLEVEL" mode="voice">

<rule id="TOPLEVEL">
    <tag> out.main = "" </tag>
  <one-of>
  <item repeat="1-">
      <ruleref uri="#ALPHANUM"/>
      <tag> out.main = out.main + rules.ALPHANUM.slot </tag>
    </item>
    <item> start again </item>
  </one-of>
</rule>

<rule id="ALPHANUM" scope="public">
    <item>
          <one-of>
            <item> a <tag> out.slot="a" </tag></item>
            <item> ay <tag> out.slot="a" </tag></item>
            <item> eh <tag> out.slot="a" </tag></item>
            <item> alpha <tag> out.slot="a" </tag></item>
            <item> b <tag> out.slot="b" </tag></item>
            <item> be <tag> out.slot="b" </tag></item>
            <item> bravo <tag> out.slot="b" </tag></item>
            <item> c <tag> out.slot="c" </tag></item>
            <item> see <tag> out.slot="c" </tag></item>
            <item> charlie <tag> out.slot="c" </tag></item>
            <item> d <tag> out.slot="d" </tag></item>
            <item> dee <tag> out.slot="d" </tag></item>
            <item> delta <tag> out.slot="d" </tag></item>
            <item> e <tag> out.slot="e" </tag></item>
            <item> ee <tag> out.slot="e" </tag></item>
            <item> echo <tag> out.slot="e" </tag></item>
            <item> f <tag> out.slot="f" </tag></item>
            <item> eff <tag> out.slot="f" </tag></item>
            <item> foxtrot <tag> out.slot="f" </tag></item>
            <item> g <tag> out.slot="g" </tag></item>
            <item> gee <tag> out.slot="g" </tag></item>
            <item> eh <tag> out.slot="g" </tag></item>
            <item> golf <tag> out.slot="g" </tag></item>
            <item> h <tag> out.slot="h" </tag></item>
            <item> aych <tag> out.slot="h" </tag></item>
            <item> hotel <tag> out.slot="h" </tag></item>
            <item> i <tag> out.slot="i" </tag></item>
            <item> eye <tag> out.slot="i" </tag></item>
            <item> indigo <tag> out.slot="i" </tag></item>
            <item> j <tag> out.slot="j" </tag></item>
            <item> jay <tag> out.slot="j" </tag></item>
            <item> juliet <tag> out.slot="j" </tag></item>
            <item> k <tag> out.slot="k" </tag></item>
            <item> kay <tag> out.slot="k" </tag></item>
            <item> kilo <tag> out.slot="k" </tag></item>
            <item> l <tag> out.slot="l" </tag></item>
            <item> elle <tag> out.slot="l" </tag></item>
            <item> lima <tag> out.slot="l" </tag></item>
            <item> m <tag> out.slot="m" </tag></item>
            <item> em <tag> out.slot="m" </tag></item>
            <item> mike <tag> out.slot="m" </tag></item>
            <item> n <tag> out.slot="n"</tag></item>
            <item> in <tag> out.slot="n" </tag></item>
            <item> en <tag> out.slot="n" </tag></item>
            <item> november <tag> out.slot="n" </tag></item>
            <item> o <tag> out.slot="o" </tag></item>
            <item> oh <tag> out.slot="o" </tag></item>
            <item> oscar <tag> out.slot="o" </tag></item>
            <item> p <tag> out.slot="p" </tag></item>
            <item> pea <tag> out.slot="p" </tag></item>
            <item> papa <tag> out.slot="p" </tag></item>
            <item> q <tag> out.slot="q" </tag></item>
            <item> queue <tag> out.slot="q" </tag></item>
            <item> quebec <tag> out.slot="q" </tag></item>
            <item> r <tag> out.slot="r" </tag></item>
            <item> are <tag> out.slot="r" </tag></item>
            <item> romeo <tag> out.slot="r" </tag></item>
            <item> s <tag> out.slot="s" </tag></item>
            <item> ess <tag> out.slot="s" </tag></item>
            <item> sierra <tag> out.slot="s" </tag></item>
            <item> t <tag> out.slot="t" </tag></item>
            <item> tea <tag> out.slot="t" </tag></item>
            <item> tango <tag> out.slot="t" </tag></item>
            <item> u <tag> out.slot="u" </tag></item>
            <item> you <tag> out.slot="u" </tag></item>
            <item> uniform <tag> out.slot="u" </tag></item>
            <item> v <tag> out.slot="v" </tag></item>
            <item> vee <tag> out.slot="v" </tag></item>
            <item> victor <tag> out.slot="v" </tag></item>
            <item> w <tag> out.slot="w" </tag></item>
            <item> double you <tag> out.slot="w" </tag></item>
            <item> whiskey <tag> out.slot="w" </tag></item>
            <item> x <tag> out.slot="x" </tag></item>
            <item> ehks <tag> out.slot="x" </tag></item>
            <item> ex ray <tag> out.slot="x" </tag></item>
            <item> y <tag> out.slot="y" </tag></item>
            <item> why <tag> out.slot="y" </tag></item>
            <item> yankee <tag> out.slot="y" </tag></item>
            <item> z <tag> out.slot="z" </tag></item>
            <item> zee <tag> out.slot="z" </tag></item>
            <item> zed <tag> out.slot="z" </tag></item>
            <item> zulu <tag> out.slot="z" </tag></item>
        </one-of>
    </item>
</rule>
</grammar> 
MattHenry
12/8/2008 10:07 AM (EST)

Just for public knowledge, I thought that I would let folks know that we have a series of tech-tip articles on our "Developers Corner" blog that details the challenges of collecting alphabetical, and alpha-numeric input. Any developer who is looking to implement this sort of feature in a voice recognition application is strongly encouraged to che3ck out these articles, as they answer many common questions, and detail the intricacies of attempting to deal with this topic in the IVR context:

http://blogs.voxeo.com/voxeodeveloperscorner/2008/05/05/certified-tech-tip-alpha-numeric-voice-recognition-grammars-part-one/

http://blogs.voxeo.com/voxeodeveloperscorner/2008/05/20/certified-tech-tip-alpha-numeric-voice-recognition-grammars-part-two/

~Matthew Henry
dom
4/9/2009 1:06 PM (EDT)
Hi,
Im facing the following problem i cant make a working grammar/rule for a none english language i.e German to accept a pin number i.e 546435. I need a rule that accepts a series of digits and then speak the digits in other language than english
I have tried using 2 rules. One defining all the numbers
i.e
<rule id="digits"
<item>eins</item>
<item>twei</item>
<item>drei</item>
.
.
.And then a rule that uses the above
stating that it accepts an item that repeats the rule of digits
<rule id="Code"
<item>
  <item repeatrule-"digits">
</item>

I dont remember the exact syntax but it was something like the above
The thing is that it does not work
Anyone now how to do this
maybe there is one rule i could use where i could define the numbers in german and state that the user can speak a combination of these numbers
Thanks in advanced
dom
MattHenry
4/9/2009 1:15 PM (EDT)

Hello Dom,


Ideally, you'd want to leverage the German speech recognition engine for optimum results. You can find some helpful information on how you can access the non-English resources below:


[url=https://evolution.voxeo.com/worldwide/languages.jsp]https://evolution.voxeo.com/worldwide/languages.jsp[/url]
[url=http://www.vxml.org/appendixm_tts.htm]http://www.vxml.org/appendixm_tts.htm[/url]
[url=https://evolution.voxeo.com/worldwide/packages.jsp]https://evolution.voxeo.com/worldwide/packages.jsp[/url]

To directly answer your specific question on developing a suitable grammar, I just happen to have a digit grammar for US-English that you can easily modify to use the German translations of the digit characters for your review:

<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" version="1.0" root="ROOT">
<rule id="ROOT" scope="public">
        <tag>$="";</tag>
<item repeat="1-16">
<ruleref uri="#DIGIT"/>
<tag>$ = $ + $DIGIT;</tag>
</item>
</rule>

<rule id="DIGIT">
<item>
<one-of>
<item>one <tag>$="1"</tag> </item>
<item>two<tag>$="2"</tag> </item>
<item>three<tag>$="3"</tag></item>
<item>four<tag>$="4"</tag></item>
<item>five<tag>$="5"</tag></item>
<item>six<tag>$="6"</tag></item>
<item>seven<tag>$="7"</tag></item>
<item>eight<tag>$="8"</tag></item>
<item>nine<tag>$="9"</tag></item>
<item>zero<tag>$="0"</tag></item>
<item>oh<tag>$="0"</tag></item>
</one-of>
</item>
</rule>
</grammar>


Regards,

~Matthew Henry
dom
4/10/2009 5:40 AM (EDT)
Thank you Matt for your response but i cant understand why its so difficult to enter a 6 digit code..
I tried your example in English and it works but in German or Greek it throws an internal error
i cant understand why. i just replaced  one two three ... with the equivalent in Greek and German

I wanted to ask i have installed the greek and german language in nuance and i a have some grammars there. DO i need to have an el-gr folder in the grammar directory under Voxeo/www/Grammars/  or not??

Finally i wanted to ask whether you are aware of any bug with the type="digits?length=1-6" command not working with none English languages?

Any suggestions would be welcomed

dom
voxeoJeffK
4/10/2009 7:54 AM (EDT)
Hello,

We'll certainly try to help. To start, may I ask what is the error you see in the logs? I think we will have a better idea of what exactly is occurring based on this information. Also, you noted that you have Greek and German Nuance languages installed. To clarify, are the installations ASR (recognition engine), TTS (text-to-speech) or both?

regards,
Jeff Kustermann
Voxeo Support
roman3m
5/3/2009 10:40 PM (EDT)
Hi Guys, I have learnt so much from this site.. very interesting.

I would like you to help me build a grammar that recognizes three spelt letters followed by three numbers (ABC123) and how can I return the value to my main application. 
voxeoJeffK
5/4/2009 3:03 AM (EDT)
Hello,

Give this grammar a try. Be warned that alphanumeric capture is notoriously tricky, and you may need to tweak according to results of your testing.

Regards,
Jeff Kustermann
Voxeo Support

===============

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

<rule id="TOPLEVEL">
    <tag> out.main = "" </tag>
    <item repeat="3">
      <ruleref uri="#ALPHA"/>
      <tag> out.main = out.main + rules.ALPHA.slot </tag>
    </item>
    <item repeat="3">
      <ruleref uri="#NUM"/>
      <tag> out.main = out.main + rules.NUM.slot </tag>
    </item>
</rule>

<rule id="NUM" scope="public">
    <item>
          <one-of>
            <item> zero <tag> out.slot="0" </tag></item>
            <item> one <tag> out.slot="1" </tag></item>
            <item> two <tag> out.slot="2" </tag></item>
            <item> three <tag> out.slot="3" </tag></item>
            <item> four <tag> out.slot="4" </tag></item>
            <item> five <tag> out.slot="5" </tag></item>
            <item> six <tag> out.slot="6" </tag></item>
            <item> seven <tag> out.slot="7" </tag></item>
            <item> eight <tag> out.slot="8" </tag></item>
            <item> nine <tag> out.slot="9" </tag></item>
        </one-of>
    </item>
</rule>
<rule id="ALPHA" scope="public">
    <item>
          <one-of>
            <item> a <tag> out.slot="a" </tag></item>
            <item> aye <tag> out.slot="a" </tag></item>
            <item> ah <tag> out.slot="a" </tag></item>
            <item> alpha <tag> out.slot="a" </tag></item>
            <item> apple <tag> out.slot="a" </tag></item>
            <item> b <tag> out.slot="b" </tag></item>
            <item> be <tag> out.slot="b" </tag></item>
            <item> bee <tag> out.slot="b" </tag></item>
            <item> beh <tag> out.slot="b" </tag></item>
            <item> bea <tag> out.slot="b" </tag></item>
            <item> bravo <tag> out.slot="b" </tag></item>
            <item> c <tag> out.slot="c" </tag></item>
            <item> cee <tag> out.slot="c" </tag></item>
            <item> sea <tag> out.slot="c" </tag></item>
            <item> ceh <tag> out.slot="c" </tag></item>
            <item> charlie <tag> out.slot="c" </tag></item>
            <item> d <tag> out.slot="d" </tag></item>
            <item> dee <tag> out.slot="d" </tag></item>
            <item> dea <tag> out.slot="d" </tag></item>
            <item> delta <tag> out.slot="d" </tag></item>
            <item> e <tag> out.slot="e" </tag></item>
            <item> eee <tag> out.slot="e" </tag></item>
            <item> eeh <tag> out.slot="e" </tag></item>
            <item> echo <tag> out.slot="e" </tag></item>
            <item> f <tag> out.slot="f" </tag></item>
            <item> eff <tag> out.slot="f" </tag></item>
            <item> efh <tag> out.slot="f" </tag></item>
            <item> foxtrot <tag> out.slot="f" </tag></item>
            <item> g <tag> out.slot="g" </tag></item>
            <item> gee <tag> out.slot="g" </tag></item>
            <item> gea <tag> out.slot="g" </tag></item>
            <item> golf <tag> out.slot="g" </tag></item>
            <item> h <tag> out.slot="h" </tag></item>
            <item> eh <tag> out.slot="h" </tag></item>
            <item> ahche <tag> out.slot="h" </tag></item>
            <item> hotel <tag> out.slot="h" </tag></item>
            <item> i <tag> out.slot="i" </tag></item>
            <item> iye <tag> out.slot="i" </tag></item>
            <item> eye <tag> out.slot="i" </tag></item>
            <item> india <tag> out.slot="i" </tag></item>
            <item> j <tag> out.slot="j" </tag></item>
            <item> jay <tag> out.slot="j" </tag></item>
            <item> jai <tag> out.slot="j" </tag></item>
            <item> juliet <tag> out.slot="j" </tag></item>
            <item> k <tag> out.slot="k" </tag></item>
            <item> kay <tag> out.slot="k" </tag></item>
            <item> kai <tag> out.slot="k" </tag></item>
            <item> kilo <tag> out.slot="k" </tag></item>
            <item> l <tag> out.slot="l" </tag></item>
            <item> el <tag> out.slot="l" </tag></item>
            <item> elh <tag> out.slot="l" </tag></item>
            <item> lima <tag> out.slot="l" </tag></item>
            <item> m <tag> out.slot="m" </tag></item>
            <item> emm <tag> out.slot="m" </tag></item>
            <item> em <tag> out.slot="m" </tag></item>
            <item> mike <tag> out.slot="m" </tag></item>
            <item> n <tag> out.slot="n" </tag></item>
            <item> en <tag> out.slot="n" </tag></item>
            <item> enn <tag> out.slot="n" </tag></item>
            <item> november <tag> out.slot="n" </tag></item>
            <item> o <tag> out.slot="o" </tag></item>
            <item> ohh <tag> out.slot="o" </tag></item>
            <item> oue <tag> out.slot="o" </tag></item>
            <item> oscar <tag> out.slot="o" </tag></item>
            <item> p <tag> out.slot="p" </tag></item>
            <item> pee <tag> out.slot="p" </tag></item>
            <item> pea <tag> out.slot="p" </tag></item>
            <item> papa <tag> out.slot="p" </tag></item>
            <item> q <tag> out.slot="q" </tag></item>
            <item> queue <tag> out.slot="q" </tag></item>
            <item> qu <tag> out.slot="q" </tag></item>
            <item> quebec <tag> out.slot="q" </tag></item>
            <item> r <tag> out.slot="r" </tag></item>
            <item> arr <tag> out.slot="r" </tag></item>
            <item> arh <tag> out.slot="r" </tag></item>
            <item> romeo <tag> out.slot="r" </tag></item>
            <item> s <tag> out.slot="s" </tag></item>
            <item> ess <tag> out.slot="s" </tag></item>
            <item> ese <tag> out.slot="s" </tag></item>
            <item> sierra <tag> out.slot="s" </tag></item>
            <item> t <tag> out.slot="t" </tag></item>
            <item> tee <tag> out.slot="t" </tag></item>
            <item> tea <tag> out.slot="t" </tag></item>
            <item> teh <tag> out.slot="t" </tag></item>
            <item> tango <tag> out.slot="t" </tag></item>
            <item> u <tag> out.slot="u" </tag></item>
            <item> ueu <tag> out.slot="u" </tag></item>
            <item> you <tag> out.slot="u" </tag></item>
            <item> uniform <tag> out.slot="u" </tag></item>
            <item> v <tag> out.slot="v" </tag></item>
            <item> vee <tag> out.slot="v" </tag></item>
            <item> vea <tag> out.slot="v" </tag></item>
            <item> victor <tag> out.slot="v" </tag></item>
            <item> w <tag> out.slot="w" </tag></item>
            <item> dubba u <tag> out.slot="w" </tag></item>
            <item> double u <tag> out.slot="w" </tag></item>
            <item> whiskey <tag> out.slot="w" </tag></item>
            <item> x <tag> out.slot="x" </tag></item>
            <item> exe <tag> out.slot="x" </tag></item>
            <item> exx <tag> out.slot="x" </tag></item>
            <item> x ray <tag> out.slot="x" </tag></item>
            <item> y <tag> out.slot="y" </tag></item>
            <item> why <tag> out.slot="y" </tag></item>
            <item> ye <tag> out.slot="y" </tag></item>
            <item> yankee <tag> out.slot="y" </tag></item>
            <item> z <tag> out.slot="z" </tag></item>
            <item> zea <tag> out.slot="z" </tag></item>
            <item> zee <tag> out.slot="z" </tag></item>
            <item> zzz <tag> out.slot="z" </tag></item>
            <item> zulu <tag> out.slot="z" </tag></item>
        </one-of>
    </item>
</rule>
</grammar>
shawnaslam1
6/1/2009 11:00 AM (EDT)
Hello,
I have to create a custom grammar for alpha numeric for one of my production running IVR. What I get the idea from the site is, it really tricky to develop accurate grammar. I am wondering many developers obviously, have done great works on this already.
Can I have any code snippet to develop 8 digit alpha numeric codes.
The rule for this code is as below:

"The max length will always be 8, and min. will be 3.  The first character will always be numeric.  Alpha characters can show up anywhere from the 2nd character on"

Please provide me any snippet of the code. Secondly I am obviously not very much familiar of the tags used in the grammar so can you also refer some good document which gives me good idea of these tags etc.

Your early response will greatly be appreciated.

Regards,
Shawn

VoxeoDustin
6/1/2009 11:38 AM (EDT)
Hello Shawn,

The grammar just above your post should be a good jumping off point for your own grammar. You can also find a good deal of information about SRGS grammars in our documentation here: http://www.vxml.org/mot_appendixj.htm

Let me know if we can be of further assistance.

Regards,
Dustin Hayre
Customer Support Engineer II
Voxeo Support
adbadel
6/16/2009 12:55 PM (EDT)
Hi,

I have a requirement to map the n-best result to a specific DTMF, assuming my n-best value is set to 3, so each result needs to be map to DTMF-1, DTMF-2, & DTMF-3 respectively.

How do I create this dynamic grammar? Any suggestion?
VoxeoDante
6/16/2009 1:28 PM (EDT)
Hello,

I think there may be a little confusion here about how n-best works.  N-best was designed to help the developer when the recognizer is not sure which utterance is the best for a spoken input.  The decision on which values to return is made by the recognizer based on a few different things, a main one being the confidence of the input.

When using DTMF input the confidence will be 100% and therefor there would only be one possible value for the recognizer to return.

If you can give us a little information about what you are trying to accomplish maybe we can recommend another method.

Please advise,
Dante Vitulano
adbadel
6/19/2009 2:08 AM (EDT)
Hi,

Yes, n-best result is based on the confidence of the input. What we want to happen is, if the the recognizer output's a confidence less than 100%, it should give options to choose from. We want these options to be map to a DTMF number, so the end-user can choose or confirm the result by using DTMF rather than voice.

We want this because, we need to present the options to the end-user using a touchscreen. Another reason is most names we have are in chinese, would be easier to display for proper verification than have it said by the system using TTS.

I hope my requirement is clear.

Hear from you soon.

Allan
MattHenry
6/19/2009 10:57 AM (EDT)


Hi there,

I think I can give you a decent starting point for this specific dialog requirement by listing out how I would see the "working parts" tying together:


1 - Initial nbest dialog executes

2 - Within the <filled> section of this dialog, you then check the nbest array length

3 - Array length is saved to a user variable

4 - <submit> the array, and the array length to confirmInput.jsp page

5 - Pull the array length variable from the querystring and save it as a JSP session variable

6 - This JSP session variable is the key to building the grammar dynamically:

FAUX CODE:

IF arraylength = 3
Grammar =

<item> 1</item>
<item> 2</item>
<item> 3</item>

ELSEIF array length = 4
Grammar =

<item> 1</item>
<item> 2</item>
<item> 3</item>
<item> 4</item>


(etc....)

7 - Using the array length as a key again, you can then dynamically populate the return values to match the array position:

<item> 1 <tag>out.myReturn ="[array value 0 + 1]";</tag></item>
<item> 2 <tag>out.myReturn ="[array value 1 + 1]";</tag></item>
<item> 3 <tag>out.myReturn ="[array value 2 +1]";</tag></item>


8 - Within the <prompt> for this "confirmInput" field, you can loop through the array results and present the caller with the available nbest array results, and once again use the length of the array to match the dtmf keys to the individual array values.

Hope this helps out!

~Matthew Henry
riteshsc
9/30/2009 2:40 PM (EDT)
I have the code as,
  <vxml>
    ....
    <form id="Fm_1">
<field name="pin">

<prompt>
Enter your PIN
<break time="300"/>
</prompt>

<prompt>
Press star to repeat
<break time="300"/>
</prompt>

<prompt>
Press pound or hang up if not available
</prompt>
<filled>
<if cond="pin.value == '#'">
<prompt>
Good Bye
</prompt>
<disconnect/>
<elseif cond="pin.value == '*'"/>

<goto next="#Fm_1"/>
<else/>
<prompt>
Your PIN is <value expr="pin"/>
</prompt>
</if>
</filled>
<nomatch>
<goto next="#Fm_1"/>
</nomatch>
<noinput>
<goto next="#Fm_1"/>
</noinput>
</field>
    </form>
....
</vxml>

I have to write grammar for the field "pin", so the field will accept only 4-digit pin or * or #.
Please help me to write grammar for the field.
VoxeoDante
9/30/2009 3:00 PM (EDT)
Hello,

If you are looking to write your own grammar for digits and want it to only allow 4 digits # or * you would want to do something like this;

<grammar xml:lang="en-US" root = "TOPLEVEL" mode="dtmf">
    <rule id="TOPLEVEL" scope="public">
<item repeat="4">
<one-of>
          <item> 1 </item>
          <item> 2 </item>
          <item> * </item>
          <item> # </item>
        </one-of>
</item>
</rule>
</grammar>

That is a pretty simple example, but you should be able to modify it to fit the rest of your needs.

I hope this helps.  I suggest looking at our grammar tutorials for a more indepth look at the grammar structure. http://www.vxml.org/mot_appendixj.htm

Regards,
Dante Vitulano
Customer Support Engineer II
Voxeo Corporation
riteshsc
9/30/2009 3:09 PM (EDT)
Hello,
Thanks for your help.
Actually I have to write grammar which accept 4 digits(ie:- 0 - 9) or single * or #

riteshsc
9/30/2009 3:11 PM (EDT)
Hello,
How can I check the values * & # (i.e:- dtmf) in voice xml filled tag?
VoxeoDante
9/30/2009 3:22 PM (EDT)
Hello,

In order to have the grammar accept either the 4 digit string, or one of * or # you will want to break those two sections out in the grammar into two different items like so;

<grammar xml:lang="en-US" root = "TOPLEVEL" mode="dtmf">
    <rule id="TOPLEVEL" scope="public">
<one-of>
<item repeat="0-1">
<one-of>
<item> * </item>
<item> # </item>
</one-of>
</item>
<item repeat="4">
<one-of>
                <item> 1 </item>
                <item> 2 </item>
                </one-of>
</item>
</one-of>
</rule>
</grammar>

To find out what the grammar match was, you should access the application.lastresult$.utterance shadow variable in the filled.

I hope this helps.

Regards,
Dante Vitulano
Customer Support Engineer II
Voxeo Corporation
bobby.christensen
12/21/2009 6:07 PM (EST)
Hey there,
I am trying to create my grammar based off of an Array element that I have created such as:

        <subdialog name="areaList" src="problemAreas.xml" >
            <filled>
                <assign name="data" expr="areaList.resultArray"/>
            </filled>
        </subdialog>
        <field name="login">
            <grammar type="text/gsl">
                <![CDATA[[
                    [phone dtmf-1] { <login "data[0]"> }
                    [email dtmf-2] { <login "data[1]"> }
                    [network dtmf-3] { <login "data[2]"> }
                    [display dtmf-4] { <login "data[3]"> }
                    [hardware dtmf-5] { <login "data[4]"> }
                    [other dtmf-6] { <login "data[5]"> }
                ]]]>
            </grammar>

as you can see in the grammar tags I am trying to pull data from each place holder in the areas array ie:areas[0] and populate the variable login as such. Is this even possible. Thanks in advance.
VoxeoDustin
12/21/2009 6:15 PM (EST)
Hello Bobby,

I don't believe this is possible with GSL grammars, however SRGS grammars support ECMAScript markup, so you may be able to accomplish this using grXML. I highly recommend using SRGS grammars anyways, as GSL is a deprecated Nuance-proprietary grammar markup that is no longer supported by them. SRGS is a W3C spec and is fully supported still.

http://www.vxml.org/grxmlbasics.htm

Let me know if you have any difficulty.

Regards,
Dustin Hayre
Solutions Engineer
Voxeo Corporation
bobby.christensen
12/21/2009 6:39 PM (EST)
To extend on the previous post, each value in the data[] is, in fact, it's own array. So there are multiple bits of information in each value that I would like to be able to retreive once a value has been selected. So, data[0] = new Array{data, data]. Thanks again.
VoxeoDustin
12/21/2009 6:43 PM (EST)
Bobby,

I just wanted to make sure you saw my previous post:


I don't believe this is possible with GSL grammars, however SRGS grammars support ECMAScript markup, so you may be able to accomplish this using grXML. I highly recommend using SRGS grammars anyways, as GSL is a deprecated Nuance-proprietary grammar markup that is no longer supported by them. SRGS is a W3C spec and is fully supported still.

http://www.vxml.org/grxmlbasics.htm

Let me know if you have any difficulty.

Regards,
Dustin Hayre
Solutions Engineer
Voxeo Corporation
suraj3334
2/9/2010 2:11 PM (EST)
Hi,

I am having a peculiar problem with grammars. I am calling grammars externally from velocity templates.

My sample grammar file:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-us" mode="dtmf" root="___ROOT___">

  <rule id="___ROOT___" scope="public">
    <one-of>
      <item>
        <item repeat="10">
          <ruleref uri="#DIGITS" />
            <tag>
            phNum = phNum + DIGITS.V;
          </tag>
        </item>
      </item>
    </one-of>
  </rule>

  <rule id="DIGITS">
    <one-of>
      <item>0</item>
      <item>1</item>
      <item>2</item>
      <item>3</item>
      <item>4</item>
      <item>5</item>
      <item>6</item>
      <item>7</item>
      <item>8</item>
      <item>9</item>
    </one-of>
  </rule>
</grammar>

But the problem is the phone number is now loading with spaces.
For example if i wish to enter 6147896543 its being logged as 6 1 4 7 8 9 6 5 4 3.

this is causing our searches to fail. I am testing this on a Voxeo browser. Any clue what this issue might be that is adding spaces.

Thanks
jdyer
2/9/2010 8:01 PM (EST)
Hello,
 
  I am afraid that with out logging its hard for me to ascertain were this error is in your code.  However I am able to provide some working examples to help you out despite the lack o logging.  There really are two ways we can handle this, the first one is the use the correct shadow variable (lastresult$.interpretation.slotName) to get the correct interpretation.  The second option is to use a JS function to parse the return.  I have included a example of each below for your reference:

JavaScript:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<form id="Form1">
  <block>
  <script>
    function removeSpaces(string) {
    return string.split(' ').join('');
    }
  </script>
    <var name="varWithSpaces" expr="'1 2 3 4'"/>
    <log expr="'@@@@@@:  ' + varWithSpaces"/>
    <var name="varWithNoSpaces" expr="removeSpaces(varWithSpaces)"/>
    <log expr="'@@@@@@:  ' + varWithNoSpaces"/>
  </block>
</form>
</vxml>

------------------------
Grammar:
------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" version="1.0" xml:lang="en-us" mode="dtmf" root="___ROOT___">
<rule id="___ROOT___" scope="public">
  <tag>out.main="";</tag>
  <item repeat="10">
  <ruleref uri="#digit"/>
  <tag>out.main = out.main + rules.digit;</tag>
</item>
</rule>

<rule id="digit">
  <one-of>
  <item>"0"</item>
  <item>"1"</item>
  <item>"2"</item>
  <item>"3"</item>
  <item>"4"</item>
  <item>"5"</item>
  <item>"6"</item>
  <item>"7"</item>
  <item>"8"</item>
  <item>"9"</item>
  </one-of>
</rule>
</grammar>

----------------------------
Application:
----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<form id="Form1">
<field name="main">
<grammar src="grammar.xml" type="application/grammar-xml"/>
<prompt>input</prompt>
<filled>
<log expr="'@@@@@@@:  ' + lastresult$.interpretation.main"/>
</filled>
</field>
</form>
</vxml>

----------------------------
RESULT:
----------------------------
MOT/VXT202.ORL.VOXEO.NET - LOG: @@@@@@@: 1234567890

I do hope this helps, and if there are any other questions on this please let us know, as our team is most certainly standing by to help!

Regards,

John Dyer
Customer Engineer
Voxeo Support
vamsi.kadiyala
2/17/2010 11:01 AM (EST)
Hi,

I am trying to generate Dynamic grammars based on some criteria.
For example I need to generate grammars based on the number of options available. A caller can have anywhere from 1 to 9 options.

If a caller has only one option i need to use only dtmf 1
2 options dtmf 1or2
..
9 options dtmf 1or2or3or4or5or6or7or8or9

Can you please point me in the right direction for generating these grammars dynamically based on the number of options
mikethompson
2/17/2010 11:37 AM (EST)
Hello,

What you'll want to do is use a simple grXML digit grammar, and depending on the number of options, you can extend the number of possible choices.  Here is a DTMF grammar that accepts DTMF-0 through 9.  It is typically for multiple digits, but you can adjust this via the repeat attribute in the first item.  For you, I have set the repeat value to zero, so this grammar accepts one digit, then considers it complete:

[code]
<?xml version= "1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root="NUMBER" mode="dtmf">

<rule id="NUMBER" scope="public">

        <item repeat="0">
            <item>
      <ruleref uri="#ZERO_TO_NINE_1"/>
            </item>
              <tag> out = out + rules.ZERO_TO_NINE_1.subSlot </tag>
        </item>
    </rule>


<rule id="ZERO_TO_NINE_1"> 
<one-of>
<item>1 <tag>out.subSlot="1";</tag></item>
<item>2 <tag>out.subSlot="2";</tag></item>
<item>3 <tag>out.subSlot="3";</tag></item>
<item>4 <tag>out.subSlot="4";</tag></item>
<item>5 <tag>out.subSlot="5";</tag></item>
<item>6 <tag>out.subSlot="6";</tag></item>
<item>7 <tag>out.subSlot="7";</tag></item>
<item>8 <tag>out.subSlot="8";</tag></item>
<item>9 <tag>out.subSlot="9";</tag></item>

</one-of>
</rule>
</grammar>
[/code]

What you could do to make this dynamic based on the number of options, is pass in a parameter to your server-side document, which denotes the number of options available.  Based on that number, you can decide how many dtmf choices you want available.  For instance, you could do:

<grammar src="MyGrammar.xml?options=5" type="application/grammar-xml"/>

Then, your server-side would get the fetch, realize there are 5 options available, then dynamically generate the grammar to look like this:

[code]
<?xml version= "1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root="NUMBER" mode="dtmf">

<rule id="NUMBER" scope="public">

        <item repeat="0">
            <item>
      <ruleref uri="#ZERO_TO_NINE_1"/>
            </item>
              <tag> out = out + rules.ZERO_TO_NINE_1.subSlot </tag>
        </item>
    </rule>


<rule id="ZERO_TO_NINE_1"> 
<one-of>
<item>1 <tag>out.subSlot="1";</tag></item>
<item>2 <tag>out.subSlot="2";</tag></item>
<item>3 <tag>out.subSlot="3";</tag></item>
<item>4 <tag>out.subSlot="4";</tag></item>
<item>5 <tag>out.subSlot="5";</tag></item>

</one-of>
</rule>
</grammar>
[/code]

Hope this helps,
Mike Thompson
Voxeo Corporation
vamsi.kadiyala
2/17/2010 2:14 PM (EST)
Thanks for the reply Mike.

Bare with me cause I am kind of new to grammars. I am trying to call the external grammar files from velocity templates.

For example I know the size of the options. And this size will keep changing.

So when I do this

<grammar src="MyGrammar.xml?options=5" type="application/grammar-xml"/> how will my grammar file know what options means.

Also I want this to be dynamic. so can i say something like

<grammar src="MyGrammar.xml?$(size)" type="application/grammar-xml"/>

where size is the number of options available.


MattHenry
2/17/2010 5:04 PM (EST)


Hello Vamsi,

What you are describing can certainly be done, but I should make a few crucial points known:

1 - A ".xml" document can't really be dynamic by nature, as xml documents are static: You'd really need to have your grammar file be a .php/.jsp/.asp document that is setup to accept the querystring parameters] that you are sending in the request.

http://www.vxml.org/qs_vars.htm

2 - This dynamic grammar document will likely have a series of conditional statements (IF/ELSE/ELSEIF) that will dictate the XML grammar content that is generated depending on the parameters that are received.

3 - You can find an example of dynamic grammar generation in our VXML tutorials that shows how this is done in the ColdFusion markup, which should illustrate how these practices are applied.

http://www.vxml.org/t_16.htm

Hope this helps!

~Matthew Henry
SSA_telespectrum
5/12/2010 11:23 AM (EDT)
Can you please provide me the grammar to recognise following two formats
1:) 25 March
2:)8 am (pm)
VoxeoBrian
5/12/2010 1:09 PM (EDT)
Hello,

I am attaching a day/month grammar, and a time grammar that should support your needs.

Regards,

Brian F.
SSA_telespectrum
5/12/2010 2:18 PM (EDT)
I think attachment is missing.
jdyer
5/12/2010 6:34 PM (EDT)
Hello,

These are attached, but unfortunitly from our perspective only (this does you little good I am afraid =^P)  That being the case I have attached gists of the two grammars below (as links), so please give this a try:

https://gist.github.com/686321eab984e13198dc
https://gist.github.com/93cc213dd440946b3715

Sorry for any confusion, and I sincerely hope that this helps.  If there is anything else we can do to be of service please let us know!


Regards,

John Dyer
Customer Engineer
Voxeo Support
gowriv89
6/30/2010 4:33 AM (EDT)
Hi,
I am new to vxml field. In my project, i have to link database and fetch information. I have defined a record "*" in database. If i provide "*" input in SIP, i am getting this voice response "MRCP recognition error". I understand that its Grammar related. But if i provide some other input, its working perfect. What should i do to make my vxml program accept * and # as input?
voxeoJeffK
6/30/2010 5:10 AM (EDT)
Hello,

* and # can be valid grammar entries. Is this using GSL or grXML format, and can you paste the grammar, or at least the entries you have for * and #?

Regards,
Jeff Kustermann
Voxeo Support
splash
9/28/2010 5:03 AM (EDT)
Hello,
Details of my application are as below:
Customer is asked to enter a 10 digit account number followed by the # key. I am using an external grammar
-----------------------------------------------------
Code.vxml

<field name="getTicketNumber">
  <grammar src="D:\sample.grxml"></grammar>       
  <prompt bargein="false">
    <audio src = "D:\m1.wav"/>
  </prompt>
  <filled>
    <prompt bargein="false">
      <audio src = "D:\m1.wav"/>
    </prompt>
  </filled>

_______________________________________________________
sample.grxml

  <grammar version="1.0"
          xml:lang="en-US"
          mode="dtmf"
          root="MYRULE"> 
 
  <rule id="MYRULE" scope="public">

    <one-of>
      <item repeat="0-"> 1 </item>
      <item repeat="0-"> 2 </item>
      <item repeat="0-"> 3 </item>
      <item repeat="0-"> 4 </item>
      <item repeat="0-"> 5 </item>
      <item repeat="0-"> 6 </item>
      <item repeat="0-"> 7 </item>
      <item repeat="0-"> 8 </item>
      <item repeat="0-"> 9 </item>
      <item repeat="0-"> 0 </item> 
      <item repeat="0-1"> * </item>
      <item repeat="0-1"> # </item>
  </one-of> 
    </rule>
</grammar>

Here where do we have to specify the maximum number of digits that a customer is allowed to enter?
voxeoJason
9/28/2010 4:19 PM (EDT)
Hi,

In all honesty, the [url=http://www.vxml.org/grxmlbuiltins.htm]digits builtin grammar[/url] is going to be the best (and easiest) way to collect that kind of information from your user.

login



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