| 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. |
| login |