Page 1 of 2
Spell a word
Posted: Fri Jun 29, 2012 10:54 am
by goochalba
Hi,
It looks like this is not possible but I wanted to double check. So if I want a user to spell their last
name and capture that this is not possible at this point correct? If I knew their last name up front
could I ask them to spell it and capture at least if it was accurate or not?
Thanks in advance!
Mike
Re: Spell a word
Posted: Fri Jun 29, 2012 11:29 am
by support
Hi Mike,
Yes, this is possible. There is a built in last name grammar, though it only covers about 90% of the US population's last names. For more information, please take a look at the VXML documentation:
http://www.plumvoice.com/docs/dev/devel ... ce:grammar
Regards,
Plum Support
Re: Spell a word
Posted: Fri Jun 29, 2012 12:06 pm
by goochalba
Great thanks so much for the quick reply! So lets say I wanted the user to spell a random word
but I will know what the word is and ask them to spell it. Would I create a dynamic grammar
to achieve this?
Thanks again!
Re: Spell a word
Posted: Mon Jul 02, 2012 2:44 pm
by support
Hi Mike,
Yes, you would have to create your own grammar. We think it would be best if you used the alphanum builtin grammar, which is currently undocumented. To limit the amount of mistakes that may occur while using it, you should modify your confidence and sensitivity properties. Here is a code example:
Code: Select all
<form>
<field>
<property name="sensitivity" value="0.2"/>
<property name="confidencelevel" value="0.75"/>
<grammar src="spelling_grammar.php" type="application/srgs+xml"/>
<prompt>Spell the word example.</prompt>
<filled>You spelled example correctly.</filled>
</field>
</form>
spelling_grammar.php would be the grammar you write using the builtin alphanum:
Code: Select all
<?php
header('Content-type: text/xml');
echo '<?xml version="1.0"?>';
?>
<grammar root="spelling" mode="voice">
<rule id="spelling">
<ruleref uri="builtin:grammar/alphanum?entries=word_list.txt"/>
</rule>
</grammar>
word_list.txt is simply a text file with the word(s) you want your users to spell:
Regards,
Plum Support
Re: Spell a word
Posted: Sat Jul 07, 2012 6:26 pm
by goochalba
Awesome thanks so much!
Re: Spell a word
Posted: Sun Jul 08, 2012 7:22 pm
by goochalba
Hi,
I have tried exactly what you have suggested and am getting the following
Code: Select all
Sun 08 Jul 2012 08:20:24.0687 PM EDT (000001;024;1341791797) [inet] EVENT: Attempting to fetch http://us.popproxy.plumgroup.com/plumvp/demo.php
Sun 08 Jul 2012 08:20:24.0716 PM EDT (000001;024;1341791797) [vxi] EVENT: DocumentParser::FetchDocument(http://ec2-user@174.129.240.84:8999/spell.vxml)
Sun 08 Jul 2012 08:20:24.0716 PM EDT (000001;024;1341791797) [vxi] EVENT: Cache Miss: http://ec2-user@174.129.240.84:8999/spell.vxml
Sun 08 Jul 2012 08:20:24.0716 PM EDT (000001;024;1341791797) [inet] EVENT: Attempting to fetch http://ec2-user@174.129.240.84:8999/spell.vxml
Sun 08 Jul 2012 08:20:24.0749 PM EDT (000001;024;1341791797) [rec] EVENT: Cache Hit: http://ec2-user@174.129.240.84:8999/spelling_grammar.php
Sun 08 Jul 2012 08:20:24.0754 PM EDT (000001;024;1341791797) [rec] ERROR: Error creating grammar
Any suggestions?
Thanks
Re: Spell a word
Posted: Mon Jul 09, 2012 7:40 am
by support
Hi,
Just a bit of clarification on the earlier example we posted.
Within spelling_grammar.php, you will want to reference the full URL of where word_list.txt exists. For example:
Code: Select all
<?php
header('Content-type: text/xml');
echo '<?xml version="1.0"?>';
?>
<grammar root="spelling" mode="voice">
<rule id="spelling">
<item>
<ruleref uri="builtin:grammar/alphanum?entries=http://myserver.com/code_examples/word_list.txt"/>
</item>
</rule>
</grammar>
Hope this helps.
Regards,
Plum Support
Re: Spell a word
Posted: Wed Jul 11, 2012 7:32 am
by goochalba
thanks I will try this out
Re: Spell a word
Posted: Wed Jul 11, 2012 7:02 pm
by goochalba
Hi,
I am still getting the same error when I try this...
Code: Select all
ed 11 Jul 2012 07:59:59.0454 PM EDT (000001;043;1342050844) [vxi] EVENT: DocumentParser::FetchDocument(http://ec2-user@174.129.240.84:8999/spell.vxml)
Wed 11 Jul 2012 07:59:59.0454 PM EDT (000001;043;1342050844) [vxi] EVENT: Cache Hit: http://ec2-user@174.129.240.84:8999/spell.vxml
Wed 11 Jul 2012 07:59:59.0456 PM EDT (000001;043;1342050844) [rec] EVENT: Cache Hit: http://ec2-user@174.129.240.84:8999/spelling_grammar.php
Wed 11 Jul 2012 07:59:59.0458 PM EDT (000001;043;1342050844) [rec] ERROR: Error creating grammar
here is my code
Code: Select all
<?php
header('Content-type: text/xml');
echo '<?xml version="1.0"?>';
?>
<grammar root="spelling" mode="voice">
<rule id="spelling">
<ruleref uri="builtin:grammar/alphanum?entries=http://<server:port>/word_list.txt"/>
</rule>
</grammar>
Thanks
Mike
Re: Spell a word
Posted: Thu Jul 12, 2012 8:05 am
by support
Hi,
Would you be able to provide us with the code snippet you are using to generate this error? The following code that we are using works for us:
spelling_example.php:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form>
<field>
<property name="sensitivity" value="0.2"/>
<property name="confidencelevel" value="0.75"/>
<grammar src="spelling_grammar.php" type="application/srgs+xml"/>
<prompt>Spell the word example.</prompt>
<filled>You spelled example correctly.</filled>
</field>
</form>
</vxml>
spelling_grammar.php:
Code: Select all
<?php
header('Content-type: text/xml');
echo '<?xml version="1.0"?>';
?>
<grammar root="spelling" mode="voice">
<rule id="spelling">
<item>
<ruleref uri="builtin:grammar/alphanum?entries=http://myserver.com/code_examples/word_list.txt"/>
</item>
</rule>
</grammar>
word_list.txt:
Hope this helps.
Regards,
Plum Support
Re: Spell a word
Posted: Thu Jul 12, 2012 10:32 pm
by goochalba
Hi,
Sorry I finally realized what was wrong. I am using Tomcat and JSPs to serve up my vxml.
So I switched the php page to a JSP and everything is great.
Thanks so much for your help and sorry for the confusion
Mike
Re: Spell a word
Posted: Fri Jul 13, 2012 1:24 pm
by goochalba
Hi,
One last question you don't mind. I am trying to give a prompt if they spell the word incorrectly. So I have been trying
Code: Select all
<vxml version="2.0">
<form>
<field name="word" type="alphanum">
<property name="sensitivity" value="0.2"/>
<property name="confidencelevel" value="0.75"/>
<grammar src="spelling_grammar.jsp" type="application/srgs+xml"/>
<prompt>Spell the word example.</prompt>
<filled>
<if conf="word===example">
<prompt>
You spelled example correctly.
</prompt>
<else/>
<prompt>
You have spelled example incorrectly
</prompt>
</if>
</filled>
</field>
</form>
</vxml>
But doesnt seem to work correctly is there a way to do this?
Thanks!
Re: Spell a word
Posted: Fri Jul 13, 2012 1:51 pm
by support
Hi Mike,
Your spelling_grammar.jsp will determine if the user has spelled the word correctly. There's no need to use another <if> tag to check. If the user spells incorrectly, a nomatch event will be thrown, and you can play your error message then. Here is an example:
Code: Select all
<vxml version="2.0">
<form>
<field name="word" type="alphanum">
<property name="sensitivity" value="0.2"/>
<property name="confidencelevel" value="0.75"/>
<grammar src="spelling_grammar.jsp" type="application/srgs+xml"/>
<prompt>Spell the word example.</prompt>
<filled>
<prompt>
You spelled example correctly.
</prompt>
</filled>
<nomatch>
You have spelled example incorrectly
</nomatch>
</field>
</form>
</vxml>
For more information on error handling, please take a look at the VXML documentation:
http://www.plumvoice.com/docs/dev/voicexml:tags:nomatch
Regards,
Plum Support
Re: Spell a word
Posted: Fri Jul 13, 2012 4:21 pm
by goochalba
Perfect! Thanks so much for all of your help!
Re: Spell a word
Posted: Fri Jul 13, 2012 4:25 pm
by goochalba
Hi,
Okay so if I spell example incorrectly it just keeps saying
"Sorry I didn't understand you"
Thanks
Mike