Page 1 of 1
Alphanumeric Grammar
Posted: Fri Mar 28, 2008 4:11 pm
by smann
Good Afternoon,
I'm trying to write a VXML app that will allow me to say or spell a system name on my network and then allow me to ping it, or read me the uptime of the system, or perform some basic operations on said system.
Computer names 9 times out of 10 are not dictionary based words, so recognizing system names like appsrv1 or COW15 will not work.
I understand that alphanumeric recognition is not the most accurate in the world, but I atleast want to test and try it out.
None of my computer names are longer then 10 characters, so after searching this board and other sites, I put together the following grammar which I am trying to get working. The system returns an error "A Serious Error, error.grammar, has occured."
Here is the external grammar file I am using:
Code: Select all
<grammar type="application/srgs+xml" root="alphanum" mode="voice">
<rule id="alphanum" scope="public">
<item repeat="1-10">
<item>
<one-of>
<item><ruleref uri="#alphabet"/></item>
<item><ruleref uri="#digit"/></item>
</one-of>
</item>
</item>
</rule>
<rule id="alphabet">
<one-of>
<item>A</item>
<item>B</item>
<item>C</item>
<item>D</item>
<item>E</item>
<item>F</item>
<item>G</item>
<item>H</item>
<item>I</item>
<item>J</item>
<item>K</item>
<item>L</item>
<item>M</item>
<item>N</item>
<item>O</item>
<item>P</item>
<item>Q</item>
<item>R</item>
<item>S</item>
<item>T</item>
<item>U</item>
<item>V</item>
<item>W</item>
<item>X</item>
<item>Y</item>
<item>Z</item>
</one-of>
</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>
My thinking is that this grammar will allow you to say one alpha or numeric character at a time up to 10 times.
My VXML to use this grammar is just very basic right now as I am trying to get it working.
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<property name="sensitivity" value="0.3"/>
<property name="recordcall" value="false"/>
<property name="voice" value="jill"/>
<form>
<field name="system">
<prompt>
Please spell any ten character word.
</prompt>
<grammar src="../SysGrammar/alphanum.grxml" type="application/srgs+xml"/>
<filled>
You said
<value expr="system"/>
</filled>
<nomatch>
<prompt>
I'm sorry that is not a valid system.
</prompt>
<reprompt/>
</nomatch>
<noinput>
<reprompt/>
</noinput>
</field>
</form>
</vxml>
There aren't too many examples of this out there, so I am hoping someone can point me in the right direction.
Thanks,
Steve
IVR code to help with Alphanumeric Grammar issue
Posted: Fri Mar 28, 2008 4:57 pm
by support
Hi Steve,
The problem with the IVR application that you are trying to write is that (as you explained in your post) you won't be able to say many of the system names that you described, such as appsrv1.
The following IVR
<grammar> example might be able to help you test and try out this IVR application, but again, would be difficult due to the non-dictionary names of the IVR servers:
servernames.grxml:
Code: Select all
<?xml version="1.0"?>
<grammar mode="voice" type="application/srgs+xml" root="servernames" version="1.0" xml:lang="en_us" xmlns="http://www.w3.org/2001/06/grammar">
<rule id="servernames" scope="public">
<one-of>
<item>appsrv1 A P P S R V 1 <tag>servername='appsrv1'</tag></item>
<item>COW15 C O W 1 5 <tag>servername='COW15'</tag></item>
<item>goodserver G O O D S E R V E R <tag>servername='goodserver'</tag></item>
</one-of></rule>
</grammar>
sayandspellserver.vxml:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<property name="sensitivity" value="0.3"/>
<property name="recordcall" value="false"/>
<property name="voice" value="jill"/>
<form>
<field name="servername">
<prompt>
Please spell any ten character word.
</prompt>
<grammar src="servernames.grxml" type="application/srgs+xml"/>
<filled>
You said
<value expr="servername"/>
</filled>
<nomatch>
<prompt>
I'm sorry that is not a valid system.
</prompt>
<reprompt/>
</nomatch>
<noinput>
<reprompt/>
</noinput>
</field>
</form>
</vxml>
Hope this helps.
Regards,
Plum Support
Posted: Sat Mar 29, 2008 3:50 pm
by smann
Good start - heading in the right direction...to expand on this, can you explain how to make tags from referenced rules be returned by the root rule? IE:
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="SysName" xml:lang="en_us">
<rule id="SysName" scope="public">
<item><ruleref uri="#systems" /></item>
</rule>
<rule id="systems" scope="private">
<one-of>
<item>A P P S R V 1</item>
<item>C O W 1 5</item>
</one-of>
</rule>
</grammar>
So, in the code above, I have my grammar which has a root ruleid of SysName, SysName in turn references the rule systems.
In the rule "systems" I have a list of items, I'd like to add a <tag> attribute to, this attribute would have the actual system name. Then I'd like that to be the response that is read back...I envision it to look something like the following:
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="SysName" xml:lang="en_us">
<rule id="SysName" scope="public">
<item>
<ruleref uri="#systems" />
<tag>SysName=alpha.$</tag>
</item>
</rule>
<rule id="systems" scope="private">
<one-of>
<item>A P P S R V 1<tag>systems=APPSRV1</tag></item>
<item>C O W 1 5<tag>systems=COW15</tag></item>
</one-of>
</rule>
</grammar>
Can you show me the correct method of formatting the grammar above so that the tag is pased back up to the root rule correctly?
Thanks
Posted: Sat Mar 29, 2008 4:00 pm
by smann
Sorry, I want to expand my example of what I'd like to do a bit...
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="SysName" xml:lang="en_us">
<rule id="SysName" scope="public">
<item><ruleref uri="#desktops" /></item>
<item><ruleref uri="#servers" /></item>
<tag>SysName=$</tag>
</rule>
<rule id="desktops" scope="private">
<one-of>
<item>C O W 1 4<tag>systems=COW14</tag></item>
<item>C O W 1 5<tag>systems=COW15</tag></item>
</one-of>
</rule>
<rule id="servers" scope="private">
<one-of>
<item>A P P S R V 1<tag>systems=APPSRV1</tag></item>
<item>P R M S R V 1<tag>systems=PRMSRV1</tag></item>
</one-of>
</rule>
</grammar>
So, now to explain a little better then last post -
I have a single root rule that references 2 child rules. Both child rules have items with tags. If there is a match I'd like the root rule to return the matches tag. I can't figure out or find an example of how to do this correctly.
Thanks
Posted: Sat Mar 29, 2008 11:47 pm
by smann
I've been playing around with the code I am writing and have made some discoveries and progress, but I'm stuck...please ignore the previous, below is the grammar and vxml I'm trying to get to work.
VXML:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<property name="sensitivity" value="0.3"/>
<property name="recordcall" value="false"/>
<property name="voice" value="jill"/>
<form>
<field name="servername">
<grammar src="../SysGrammar/alphanum.asp" type="application/srgs+xml"/>
<prompt>
Spell the name of the server, the best option is to use the phonetic alphabet, example A as in Alpha.
</prompt>
<filled>
You said
<value expr="servername"/>
</filled>
<nomatch>
<prompt>
I'm sorry that is not a valid system.
</prompt>
<reprompt/>
</nomatch>
<noinput>
<reprompt/>
</noinput>
</field>
</form>
</vxml>
The Grammar:
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="alphanum" xml:lang="en_us">
<rule id="alphanum" scope="public">
<one-of>
<item repeat="1-"><ruleref uri="#alpha" /><tag>result=alpha.letter</tag></item>
<item repeat="1-"><ruleref uri="#num" /><tag>result=num.number</tag></item>
</one-of>
</rule>
<rule id="alpha" scope="private">
<one-of>
<item>A<tag>letter="A"</tag></item>
<item>A as in alpha<tag>letter="A"</tag></item>
</one-of>
</rule>
<rule id="num" scope="private">
<one-of>
<item>1<tag>number="1"</tag></item>
</one-of>
</rule>
</grammar>
I've obviously only included recognition of one letter and one number just for development phase. What I would like to be able to do is spell a word, with either just a letter (A) or saying the phrase "a as in alpha", and have it return the letter A, but I want to be able to repeat. so I can say "a as in alpha" "a as in alpha" and the tags will work in a way that returns AA. I've played around and found some combinations that will recognize me saying a as in alpha a as in alpha, twice, but the tag returned is only a single A.
I can not get it to recognize the repitition properley.
Hope you can help.
IVR code fix for recognize repetition properly
Posted: Mon Mar 31, 2008 11:07 am
by support
Hi Steve,
You can use the following IVR code example to achieve this. Note the IVR
<grammar> in alphanum.grxml:
VXML:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<property name="sensitivity" value="0.3"/>
<property name="recordcall" value="false"/>
<property name="grammarmaxage" value="0"/>
<form>
<field name="servername">
<prompt>
Spell the name of the server, the best option is to use the phonetic alphabet, example A as in Alpha.
</prompt>
<grammar src="alphanum.grxml" type="application/srgs+xml"/>
<filled>
You said
<value expr="servername"/>
</filled>
<nomatch>
<prompt>
I'm sorry that is not a valid system.
</prompt>
<reprompt/>
</nomatch>
<noinput>
<reprompt/>
</noinput>
</field>
</form>
</vxml>
alphanum.grxml:
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="alphanum" xml:lang="en_us">
<rule id="alphanum" scope="public">
<one-of>
<item repeat="1-"><ruleref uri="#alpha" /></item>
</one-of>
</rule>
<rule id="alpha" scope="private">
<one-of>
<item>A<tag>SWI_literal="A"</tag></item>
<item>A as in alpha<tag>SWI_literal="A"</tag></item>
</one-of>
</rule>
</grammar>
This IVR example will allow you to say, "A as in alpha, A as in alpha", and "AA" would be returned.
Regards,
Plum Support
Posted: Mon Mar 31, 2008 11:17 am
by smann
Sweet-thanks will test this out on my app right away.
Probably the last related question on this topic:
Is there a way in the no match even to return the matches the speech recognizer returned?
I noticed in the log that if I say certain things it returns possible more then one match with a probability. IE:
Just as a fictitious example, if I say "A A"
The matches it might return in the call log say something like:
Match Found: A A (90.00)
Match Found: A (10.00)
My idea is that after the person speaks I'd like to say "Did you say A?" Yes or No
If No, automatically ask if they said the other probability "Did you say A A?" Yes or No
Does that make sense? and if so, can it be done with something like application.lastresult$.[some object here]?
Lower confidence level to never get nomatch on IVR app
Posted: Mon Mar 31, 2008 12:22 pm
by support
Hi,
I would recommend just lowering your confidence level to a low value such as 0.1 or 0.2 to ensure that you never get a
nomatch on your IVR application.
Code: Select all
<property name="confidencelevel" value="0.1"/>
Regards,
Plum Support