| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<meta maintainer> declaration for debugging purposes. If you feel a little rusty on the subject, checking out the <meta> element might help you refresh your memory.
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<meta name="maintainer" content="yourEmail@here.com"/>
</vxml>
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.0">
<meta name="maintainer" content="yourEmail@here.com"/>
<form id="F1">
<field name="F_1">
<grammar src="NameGram.xml" type="application/grammar-xml"/>
<prompt>
Please tell me your full name so I can verify you
</prompt>
</field>
<filled mode="all" namelist="F_1">
<prompt>
Your name is <value expr="F_1"/>
<break strength="medium"/>
</prompt>
</filled>
</form>
</vxml>
<grammar src="NameGram.xml" type="application/grammar-xml"/> to fetch the information. "NameGram.xml" is the name of the grammar file. Something to keep in mind is that to be successful when calling an external grammar file, we must make sure that the grammar file and the main file are on the same directory.
<?xml version= "1.0"?>
<grammar xml:lang="en-us" root = "TOPLEVEL” xmlns="http://www.w3.org/2001/06/grammar">
<!-- This grammar is overcomplicated by design to illustrate the concepts laid out in the SISR specification:
http://www.w3.org/TR/semantic-interpretation/#SI3.3.2 -->
<rule id="TOPLEVEL" scope="public">
<!-- Initializes both first and middle name in case one of them is not uttered.-->
<tag>out.firstNameSlot="";</tag>
<tag>out.middleNameSlot="";</tag>
<item>
<!-- Returns the first name. -->
<item repeat="0-1">
<ruleref uri="#FIRSTNAME"/>
<tag>out.firstNameSlot=rules.FIRSTNAME.firstNameSubslot;</tag>
</item>
<!-- Returns the middle name.-->
<item repeat="0-1">
<ruleref uri="#MIDDLENAME"/>
<tag>out.middleNameSlot=rules.MIDDLENAME.middleNameSubslot;</tag>
</item>
<!-- Returns the last name. -->
<ruleref uri="#LASTNAME"/>
<tag>out.lastNameSlot=rules.LASTNAME.lastNameSubslot;</tag>
<!-- Returns TOPLEVEL to the main code.-->
<tag> out.F_1 = out.firstNameSlot + out.middleNameSlot + out.lastNameSlot; </tag>
</item>
</rule>
</grammar>
<tag>out.firstNameSlot="";</tag> is used to initialize the variable firstNameSlot and <tag>out.middleNameSlot="";</tag> is used to initialize the variable middleNameSlot. If the user decides to not say a first or middle name, then the variable will just be blank and not return an error.<item repeat="0-1"> element. This is used to let us know that this segment of the grammar is optional and therefore, we use the repeat=”0-1.” With this, the grammar will be looking for zero to one item there.<ruleref> element. This is used to call the subgrammar that is written in the grammar file. We use the name such as <ruleref uri="#FIRSTNAME"/> to call the subgrammar. In this case, we are calling the FIRSTNAME subgrammar.
<?xml version= "1.0"?>
<grammar xml:lang="en-us" root = "TOPLEVEL" xmlns="http://www.w3.org/2001/06/grammar">
<!--
This grammar is overcomplicated by design to illustrate the concepts laid out in the SISR specification:
* http://www.w3.org/TR/semantic-interpretation/#SI3.3.2
-->
<rule id="TOPLEVEL" scope="public">
<!-- Initializes both first and middle name in case one of them is not uttered.-->
<tag>out.firstNameSlot="";</tag>
<tag>out.middleNameSlot="";</tag>
<item>
<!-- Returns the first name. -->
<item repeat="0-1">
<ruleref uri="#FIRSTNAME"/>
<tag>out.firstNameSlot=rules.FIRSTNAME.firstNameSubslot;</tag>
</item>
<!-- Returns the middle name.-->
<item repeat="0-1">
<ruleref uri="#MIDDLENAME"/>
<tag>out.middleNameSlot=rules.MIDDLENAME.middleNameSubslot;</tag>
</item>
<!-- Returns the last name. -->
<ruleref uri="#LASTNAME"/>
<tag>out.lastNameSlot=rules.LASTNAME.lastNameSubslot;</tag>
<!-- Returns TOPLEVEL to the main code.-->
<tag> out.F_1 = out.firstNameSlot + out.middleNameSlot + out.lastNameSlot; </tag>
</item>
</rule>
<rule id="FIRSTNAME" scope="public">
<one-of>
<item> matt<tag>out.firstNameSubslot="matthew";</tag></item>
<item> dee <tag> out.firstNameSubslot="dee ";</tag></item>
<item> jon <tag> out.firstNameSubslot="jon ";</tag></item>
<item> george <tag>out.firstNameSubslot="george ";</tag></item>
<item> billy <tag> out.firstNameSubslot="billy ";</tag></item>
</one-of>
</rule>
<rule id="MIDDLENAME" scope="public">
<one-of>
<item> bon <tag>out.middleNameSubslot="bon ";</tag></item>
<item> dee <tag> out.middleNameSubslot="dee ";</tag></item>
</one-of>
</rule>
<rule id="LASTNAME" scope="public">
<one-of>
<item> henry <tag> out.lastNameSubslot="henry "; </tag></item>
<item> ramone <tag> out.lastNameSubslot="dee "; </tag></item>
<item> jovi <tag> out.lastNameSubslot="jovi "; </tag></item>
<item> bush <tag> out.lastNameSubslot="bush "; </tag></item>
<item> williams <tag> out.lastNameSubslot="williams "; </tag></item>
</one-of>
</rule>
</grammar>
<item> element is inside of the <one-of> element and returns the first name option that is uttered. The same thing happens for the middle and last name. The difference is that, unlike other grammars that we have learned about so far, this returns to the TOPLEVEL rule rather than the main function. At that point ,the three utterances are added together and returned as a single utterance back to the main function.| ANNOTATIONS: EXISTING POSTS |
moshe
|
|
| In order for the "name slot to match up with the return slot", the rule has to start like this:
.FULLNAME [ NAME:d {<F1 $d>} ] and not <MyName $d> as in the example. (And if I'm wrong, could we get an explanation of how the name stot matches up with the return slot?) |
|
eosmann
|
|
| It does appear that "NAME:d {<MyName $d>}" should read "NAME:d {<F_1 $d>}". Correct?
Cheers. |
|
MattHenry
|
|
| Hi guys,
You both are as right as rain; thanks to all for the catch. The corrected version should be posted within the next few days. ~Matt |
|
henryanelson
|
|
| Does the F_1 reference the field name? | |
MattHenry
|
|
|
hello Henry, I am assuming that you are speaking of the top level rule return in the grammar file: FULLNAME [ NAME:d {<F_1 $d>} ] ..which does, in fact, refernce the fieldname. You might check our docs on grammar slots for additional information on this topic: http://docs.voxeo.com/voicexml/2.0/gslslots.htm ~Matt |
|
danielvinson
|
|
| I am attempting to adapt the code such that it recognises a PIN ie 0-9 for between 5-8 digits. It is proving harder than expected. It seem to limit the number of options for each entry to 4. Is this due to the rules?
Regards Daniel |
|
mikethompson
|
|
| Hi Daniel,
You can save yourself a lot of trouble by using our builtin digits grammar for your PIN entry system. You can check out all of our builtin grammars here: http://docs.voxeo.com/voicexml/2.0/gslbuiltins.htm#start Here's a quick example of using type="digits" with a maximum length of 8 and a minimum length of 5. <field name="F_1" type="digits?minlength=5;maxlength=8"> ... <filled> <prompt> your input was <value expr="F_1"/>. </prompt> </filled> </field> Hope this helps, Mike Thompson Voxeo Corporation |
|
danielvinson
|
|
| Hi Mike
Thanks for your reply. What about if I wanted to recognise a postcode (ie a combination of letters and numbers) ? I assume the digits function won't work. What options do I have? Daniel |
|
jbassett
|
|
| Hello,
Alphanumeric is *very* difficult to capture accurately....'B' sounds like 'D' sounds like '3', world without end. I'm not saying that All Hope Is Lost, simply attempting to make it clear that devising such a grammar is going to require some time devoted to testing, tuning, retesting, retuning, rinsing, repeating. Here are some link you might find useful. If you would like to go to our support forums and open a ticket on this, I can give you a alphanumeric grammar example for Canadian zip codes. http://docs.voxeo.com/voicexml/2.0/t_14_mot.htm http://docs.voxeo.com/voicexml/2.0/t_20.htm http://docs.voxeo.com/voicexml/2.0/w3cprops.htm Thanks Jesse Bassett Voxeo Support |
|
danielvinson
|
|
| Hi Jesse
Thanks for the reply. I read that alphanumeric is difficult before. I assume by limiting the number of options for each character will improve the accuracy. Forgetting about the accuracy problems for the moment do you think it is possible to adapt the above code (first, middle and last names) to ask for a postcode? If so can you give me a hint. Thanks Daniel |
|
MattHenry
|
|
|
Daniel, The code that was attached *is* for alphanumeric zip code capture, so I am a bit confused as to your question....please advise as to what I am not understanding. ~Matt |
|
georgelai
|
|
| I was just wondering... instead of using subGrammars, could I resend a voice wav file to a grammar xml file to decode different parts of the wav file?
For example, I have a voice wav file saying... "quick brown fox jumped over the lazy dog" and I have grammar code: PARTOFSENTENCE [ PART:b {<F_1 $b>} ] PART [ (WORD:a) {return($a)} ] WORD [ [quick] {return("quick ")} [fox] {return("fox ")} [brown] {return("brown ")} [jumped] {return("jumped ")} [over] {return("over")} [lazy] {return("lazy")} [dog] {return("dog")} ] If there a way to run the voice wav file through the grammar check so that when the first word "quick" is recognized, then some code would "chop" the wav file and remove "quick" from the wav file (or ignore it), and run the wav again through the grammar to recognize "brown", and etc. So instead of: "quick brown fox jumped" one could potentially also say: "brown dog jumped over lazy fox" and both texts would be converted to text. Maybe I am asking for an impossible approach, but this way a whole sentence could be parsed into text without having discrete positions for words. True, it would be slow for long phrases... |
|
voxeojeff
|
|
| Hello,
Technically, what you are asking for is possible, and would require a complex grammar file. However, before we steer you down this path, we would like to know what exactly you are trying to accomplish here, in detail. If you would be so kind, can you explain the purpose and flow of your application? Thank you, Jeff Menkel Voxeo Corporation |
|
parit
|
|
| hi,
I am using n-Best list along with an external grammar file and having a conceptual problem. Grammar file is as follows: SEARCHSTRING [ STRING:a <id $a> ] STRING [ (NAMES:b ?NAMES:c) {return(strcat($b $c))} ] NAMES [ [hit] <return("hit")> [sit] <return("sit")> ] Now when I say "hit" the engine also recongnises "sit" with some probability (coz I have allowed it to have at max 5 results). In that case what should be the slot value of b and ultimately of a? Please put in ur comments. |
|
MattHenry
|
|
|
Hi there, I am not sure that this grammar is going to fill slots b and c at all: it appears as if you are trying to fill multiple sub-slots from the same utterance value, and I don't think that this is going to work at all using the method that you are using.....my gut reaction is that this will throw a sizable grammar error when you attempt to run it. Perhaps you can try and give me an idea of what your end goal is in this regard so that I can better understand what you are trying to achieve here? ~Matt |
|
mikejstein
|
|
| I'm trying to put a subgrammar together, that would take both text and numbers. I've got to handle any number, so I can't use a text grammar for it. So if somebody called up and said "BUY 25400", or "SELL 193", it'd work just the same.
I haven't seen anything on mixing grammar types in a subgrammar. Any ideas? |
|
MattHenry
|
|
|
Hi there, Assuming that you aren't trying to mix dtmf and voice input, this should be pretty do-able. A good starting point for yo would be to take a gander at the downloadable subgrammars at the below link: http://evolution.voxeo.com/library/grammar/library.jsp Specifically, eyeball the one titled "numbers2sixteen.grammar", as this contains all the number grammars that you need without having to reinvent the wheel. Assuming that you use the 4 digit string as your low-level rule, you'd simply define your text rule in the file, and then concatenate the results together at the top level rulename, much like we do in this humble tutorial: MY_TOP_RULE [ MY_SUBRULE:z {<mySlotName $z>} ] MY_SUBRULE [ ( MYNUMBER:d1 MYTEXT:d2 ) {return(strcat($d1 $d2))} ] Hope this helps! ~Matt |
|
mzelik
|
|
| I am getting the following error when testing the downloaded code:
00142 bd50 12:49:44 AM =========================== An error occurred while executing the following dialog. Initial URL1: http://mike.softrite.com/subG.xml Initial URL2: null Initial URL3: null Current URL: http://mike.softrite.com/subG.xml?session.callerid=9546104367&session.calledid=4079929967&session.sessionid=e6c15423f50779f419c06c1d6ad4bd50&session.parentsessionid=95b6b35aa44a6ff53bfa9d652cd607b0 Calling Number (ANI): 9546104367 Called Number (DNIS): 4079929967 Redirecting Number (RDNIS): "" State: Form1 VoiceXML Browser Version: 8.0.27086 Date/Time: 2008/4/4 12:49:45.796 VoiceException: error.badfetch.http.404 Failed fetch with code: 404 (Not Found), URL: http://mike.softrite.com/gsl/MySubGrammar.gsl Dialog stack trace: State (Dialog) URL (Document) -------------- ------------------------------ Form1 http://mike.softrite.com/subG.xml?session.callerid=9546104367&session.calledid=4079929967&session.sessionid=e6c15423f50779f419c06c1d6ad4bd50&session.parentsessionid=95b6b35aa44a6ff53bfa9d652cd607b0 The error message is from the Voxeo application debugger. I am using the downloaded code from Voxeo, except for the location of the GSL file. I changed the location to see if that was the problem, but got the same error. I know the GSL file is on the server. I am just learning VoiceXML and vxml for that matter. I looked at the code and cannot see any errors. I used a different WEB server and received the same error. I am stumped. Please advise. Thanks. |
|
voxeojeremyr
|
|
| Hi,
From the error, you are receiving a HTTP error code of 404, which means that the page that it is looking for cannot be found. error.badfetch.http.404 Failed fetch with code: 404 (Not Found), URL: http://mike.softrite.com/gsl/MySubGrammar.gsl I tried to get to that URL but I was unable to. It may be behind a firewall which is why you are getting that error. Thanks, Jeremy Richmond Voxeo Support |
|
mzelik
|
|
| I have made some headway on the problem.
After trying many things, I fould that when I rename the file with an XML extension and change the code accordingly, it works! I am not sure what is causing the problem, but this at least will allow me to continue on the training material. Thanks for your assistance. |
|
prabodhprakashibm
|
|
| Hey All,
If I have a sentence like, I want Indica from 24th June to 25th June from Jaipur to Jaisalmer. Now, this sentence can be said in many ways, i want to recognize only Indica and two dates from the sentence, how can we do that. Thank-you very much Prabodh Prakash |
|
VoxeoDustin
|
|
| Hey Prabodh,
In this case, you'd want to make use of the built-in garbage grammar that will ignore utterances that do not match the rest of the grammar: <grammar type="application/grammar+xml" xml:lang="en-US" root="MAIN"> <rule id="MAIN"> <ruleref uri="#CITY"/> <ruleref uri="#DATE"/> <ruleref special="GARBAGE"/> </rule> http://www.w3.org/TR/speech-grammar/#S2.2.3 Let me know if this is helpful. Regards, Dustin Hayre Customer Support Engineer II Voxeo Support |
| login |
|