| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| id | Data Type: ID | Default: Required |
| The id attribute specifies the rulename of the grammar. Rulenames must be unique within the file itself, and may not contain hyphens, colons, or periods. | ||
| scope | Data Type: (private|public) | Default: private |
| The scope attribute denotes whether or not the XML grammar is a private (local), rule, or if it is a public rule, which is used for an external rule reference. | ||
| <?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> Which is it better to be, a Call XML snob, or a Voice XML snob? </prompt> <grammar src="MyRuleGrammar.xml" type="application/grammar-xml"/> <filled> <prompt> Thats right. Voice XML rocks the hizzau! </prompt> </filled> </field> </form> </vxml> |
| <?xml version= "1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root = "MYRULE"> <rule id="MYRULE" scope="public"> <one-of> <item> voice x m l snob </item> </one-of> </rule> <!-- Hey, what did you expect? We *all* know which one is King.--> </grammar> |
| ANNOTATIONS: EXISTING POSTS |
moshe
|
|
| It goes without saying that this element has plenty of parents and children, as shown in the example. The lack of parents and children is a documentation error. | |
MattHenry
|
|
| The inclusion of these parent/child relationships was flagged in our DB for the VWS platform, but was overlooked within the Motorola docset. This has been corrected in our most recent Build, and will be posted to the 'live' content shortly.
~Matt |
|
mtatum111
|
|
| Hi, I am trying to get the specific on <token> element. Are all 3 of the following an equivalent way to use <token>.
Thanks in Advance! <rule id = "my_fruit" scope = "public"> apple </rule> <rule id = "my_fruit" scope = "public"> <item> apple </item> </rule> <rule id ="my_fruit" scope = "pubic"> <token> apple </token> </rule> |
|
voxeoJeffK
|
|
| Hi,
All three of the examples you provided will match the word "apple". Do you have some confusion over the use of <token> versus <item>? Regards, Jeff Kustermann Voxeo Support |
|
mtatum111
|
|
| Hi Jeff, My confusion came in at the fact that sometimes you would have to use the <token> tag
such as <rule id ="my_fruit" scope = "pubic"> <token> apple </token> </rule> whereas other times you don't have to use it <rule id ="my_fruit" scope = "pubic"> apple </rule> It looks like <token> is optional. If it is not put in then it is implied. Am I correct on this? Thanks |
|
voxeojeremyr
|
|
| Hi,
You are correct. According to the W3C specification on SRGS, "Token Content: In both the XML Form and ABNF Form any unmarked text within a rule definition, except example phrases (XML only) or tag content, is token content." Because of this we rarely see the <token> tag used. Most of the time the utterance is marked with <item>, as it has additional attributes that can be used. Regards, Jeremy Richmond Voxeo Support |
|
jefo12
|
|
| Hi Richmond thanxs for your reply your grammar help me alot but i have a small problem with the code below.when when i try to execute the code below it says pls select a pizza and then hangup.
Iam not able to prompt what the user selected.Can you pls check out this.Is there any thing wrong with this grammar..?pls help me out.. <form id="multipleslots"> <field name="Pizza"> <grammar mode="voice" xml:lang="en-US" version="1.0" root="TOPLEVEL" tag-format="semantics/1.0-literals"> <rule id="TOPLEVEL" scope="public"> <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> </rule> <rule id="NUMBER" scope="public"> <one-of> <item> one <tag> out.numberSubSlot="one " </tag> </item> <item> two <tag> out.numberSubSlot="two " </tag> </item> </one-of> </rule> <rule id="SIZE" scope="public"> <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> </grammar> <prompt>please select a pizza </prompt> <filled> <prompt> You want <value expr="Pizza$.interpretation.numberslot"/> <value expr="Pizza$.interpretation.sizeslot"/> </prompt> </filled> </field> </form> </vxml> |
|
voxeoJeffK
|
|
| Hi,
I tried your grammar and it worked fine. One thing I might suggest is the end prompt is rather brief, and adding a <break> before and after might allow you to hear it better: <prompt> <break strength="weak"/> You want <value expr="Pizza$.interpretation.numberslot"/> <value expr="Pizza$.interpretation.sizeslot"/> <break strength="weak"/> </prompt> If you continue to have difficulties, I suggest opening a Support ticket with us, and including a log output so that we may investigate further into the issue. regards, Jeff K. |
|
vamsi.kadiyala
|
|
| Hi I am using the following grammar for our requirement.
Our Requirement is while entering something like a phone number we enter star then we need to start from the beginning again. So for that I am doing this <rule id="___ROOT___" scope="public"> <item> <item repeat="0-1"> <item repeat="1-9"> <ruleref uri="#DIGITS"/> </item> <item> * </item> </item> <item repeat="10"> <ruleref uri="#DIGITS" /> </item> </item> </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> I am doing this so I can grab all the digits they entered including the star. One more requirement we have is as soon as we enter the 10 digit phone number we need to go to the next node. For that i use termtimeout. But the problem with above grammar is when I just enter a 10 digit phone number, the browser does not pick up that the required digits have been entered and waits until the interdigit timeout. But when i enter 9 digits followed by a * and then the 10 digit phone number it immediately goes to nect node based on termtimeout. Any clues why the browser is doing that? Thanks in Advance |
|
voxeoJohn
|
|
| Hello,
The issue you were having had to do with the top level rule, whereas your rule required 0-1 of each item ( digits or * ). Since the repeat range was 1-9 you will have to wait for the timeout value to expire unless to satisfy this items maximum, or the ASR receives a termChar. This really leaves you with two options, either setting the repeat to 10 and including the * in the grammar (see this example https://gist.github.com/55d1e5b14e798d53a6b2 ), or you can use the W3C Property ( http://www.vxml.org/w3cprops.htm ) termchar to set the terminating char to an asterisks. Also please be aware that the spec unfortunately does not provide a direct method to determine if an utterance was terminated by timeout or terminating character. Even though there is no built in way to do this it does not mean it can not be done. In fact Dustin, of our Solutions Engineering team, has a great posting on this here ( http://tinyurl.com/ykbxpgq ) that you may want to check out. I do hope this helps, and if there are any other questions please let us know! Regards, John Dyer Customer Engineer Voxeo Support |
|
vamsi.kadiyala
|
|
| Hi John,
Thanks for the swift reply. But I will not be able to use the solution as I do not want * to be treated as a termination character. I want it to be treated as a startover character. So i need to capture what is entered after *. The grammar works fine and I am abl to capture everything. For example if I enter 123456*4035672345 I am able to capture the whole thins and do some filtering to remove the characters before *. But my problem is the browser waits for "interdigittimeout" even after i enter 10 digits. And this is happening because of the first two item tags where we look for 1-9 digits and the star like you mentioned. Is there a way in which I can force the browser to use termtimeout immediately after i enter the 10 digits. Any help is greatly appreciated. |
|
voxeoJohn
|
|
| Hello,
The example I provided I think still applies here, you can simply modify the repeat attribute of the item tag from 10 to 1-10. What this means is the item must occur at least once, and repeat up to 10 times. So in my test case I called in and keyed in a 10 digit value and the logs return the following: <input mode="dtmf">dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-star dtmf-7 dtmf-8 dtmf-9 dtmf-1</input> </interpretation> </result> LOG: @@@@ 1 2 3 4 5 * 7 8 9 1 I do hope this helps, and if there are any other questions please let us know! Regards, John Dyer Customer Engineer Voxeo Support |
| login |