| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<field name="F_1" type="digits?length=3">
<field name="MyField">
<grammar src="MyXMLWrapper.xml" type="application/grammar-xml"/>
...
<?xml version= "1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xml:lang="en-US"
root="MYRULE">
<rule id="MYRULE">
<one-of>
<item>
<ruleref uri="builtin:x-nuance-firstnamespelling"/>
<tag><![CDATA[ <MyField $return> ]]> </tag>
</item>
</one-of>
</rule>
</grammar>
<ruleref> tag; take special note of the fact that this needs a prefix of 'builtin:' before the grammar name itself. Also note that within the <tag> return value, we use the same slot value as our <field>. This is very important; if this isn't followed to the letter, then you will likely see problems when attempting to access the returned values. Now that we have the XML Wrapper syntax committed to memory, let's take a look at all the cool grammars that we can plug into this, shall we? A listing of these new additions with a brief description follows:| Extension Grammar |
| x-nuance-strictboolean |
| Extension Grammar |
| x-nuance-strictphone |
| Extension Grammar |
| x-nuance-strictnumber |
| Extension Grammar |
| x-nuance-currency-10m |
| Extension Grammar |
| x-nuance-currency-100k |
| Extension Grammar |
| x-nuance-currency-10k |
| Extension Grammar |
| x-nuance-currency-1k |
| Extension Grammar |
| x-nuance-militaryalphabet |
| Extension Grammar |
| x-nuance-namespelling |
| Extension Grammar |
| x-nuance-firstnamespelling |
| Extension Grammar |
| x-nuance-lastnamespelling |
| Extension Grammar |
| x-nuance-creditcardaccount |
| Extension Grammar |
| x-nuance- creditcardexpiration |
| Extension Grammar |
| x-nuance-percentage |
| Extension Grammar |
| x-nuance-socialsecurity |
| Extension Grammar |
| x-nuance-zipcode |
| Extension Grammar |
| x-nuance-stockprice |
| Extension Grammar |
| x-nuance-countries |
| Extension Grammar |
| x-nuance-us-states |
| Extension Grammar |
| x-nuance-us-cities |
| Extension Grammar |
| x-nuance-world-cities |
| Extension Grammar |
| x-nuance-cities |
| Extension Grammar |
| x-nuance-duration-days |
| Extension Grammar |
| x-nuance-duration-minutes |
| ANNOTATIONS: EXISTING POSTS |
moshe
|
|
| "And of course, we *always* have to specify the grammar 'type' attribute, but you knew that already, didn't you?"
If that's true, why doesn't the example "MyRule" have the 'type' attribute declared? And what would the 'type' be for these external built-in grammars? |
|
MattHenry
|
|
| Moshe..
The grammar type is inherently determined when the XML grammar wrapper is hit. To explain: -The grammar is declared to be of type 'application/grammar-xml' within the vxml document itself....this validates the statement that 'type' needs to be declared - The builtin x-nuance grammar that is referenced returns a simple slot value to this XML grammar wrapper, nothing more. As such, there isn't any need to define the grammar type within the XML grammar file itself In short, i don't think that this is a documentation error at all, but a misinterpretation of the docs themselves. The code listed in the above section does indeed work as-is, and does not require anything else for the developer to add. ~Matt |
|
moshe
|
|
| Ah, I see it now:
<grammar src="MyXMLWrapper.xml" type="application/grammar-xml"/> contains the required 'type' declaration, and the grammar following it, MYRULE, is the content of the file MyXMLWrapper.xml -- and doesn't need a declaration of 'type.' I thought the sentence about requiring a type was a forward reference to MYRULE, not a backwards reference to <grammar 'src=...'>. Thanks! |
|
DaveMorris
|
|
| x-nuance-creditcardaccount says 14 to 15 digit credit card numbers. Is there such a thing as a 14 digit credit card number? What about the majority of cards that are 16 digits? | |
MattHenry
|
|
|
Hiya Dave, That's a typo on my part, that should read as "15-16 digit credit card numbers". Thanks for catching that; I'll correct this in our next bulid of the dcos. ~Matt |
|
movoco
|
|
| Is it possible to use a built-in gramamr within a mixed-initiative dialog?
Ideally, I'd like to collect the city and state from a caller within a single dialog. thanks |
|
mikethompson
|
|
| Greetings Movoco,
I have not done this myself, but in theory, it should work. The W3C specification actually has a nice example of exactly what you are looking to accomplish (minus the builtin grammars) here: http://www.w3.org/TR/voicexml20/#dml2.1.5 Now, you can easily swap the grammar sources to use nuance extension grammars. Just make sure you are referencing your grammars with a grXML wrapper as noted at the top of the tutorial. Also make sure both the State and City extension grammars are required in a single <item> (as you want to capture this in one user utterance). Lastly, make sure you are returning each match to the correct field (x-nuance-us-states returns to the state field). For example: <ruleref uri="builtin:x-nuance-us-states"/> <tag><![CDATA[ <MyStateField $return> ]]> I hope this helps get you started with mixed initiative dialogs referencing builtin nuance extension grammars. I should also mention, these extension grammars are not available on our Prophecy platform, but our hosted environment has this readily accessible. Best, Mike Thompson Voxeo Corporation |
|
arjunpatel
|
|
| plese send me an vxml example link that take voice input from uesr like users name like arjun or methuee but these fields not have to be satatic, i mean if i say "hellow:" it return me "hellow" but i dont wants to specify these name in grammer field like [arjun hello]
i need an build-in grammer that return me anything whatever i spell |
|
arjunpatel
|
|
| plese send me any simple example that uese the bild-in grammer and also write the instructions that how to upload and run this example | |
jbassett
|
|
| Here is an example of a vxml file referencing an external grammar.
XML file: <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.0" > <form> <field name="MyField"> <grammar src="mygrammar.xml" type="application/grammar-xml"/> <prompt bargein="false"> this is a test of the namespelling grammar you can begin now </prompt> </field> </form> </vxml> mygrammar.xml <?xml version= "1.0"?> <grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root="MYRULE"> <rule id="MYRULE"> <one-of> <item> <ruleref uri="builtin:x-nuance-namespelling"/> <tag><![CDATA[ <MyField $return> ]]> </tag> </item> </one-of> </rule> </grammar> To figure out how to upload these files and test, please check out our quick start guide. http://evolution.voxeo.com/docs/quickStart.jsp Thanks Jesse Bassett Voxeo Support |
| login |
|