I am having some difficulty and am somewhat new to the various Grammars that exist out there.
I have tried to follow the Plum documentation on Grammars and they provide the following JSGF example, however it does not function as described.
In the following example it matches everything I say to {Turtle} when I need it to match the dog elements to Dog and the cat elements to Cat.
Also if I wanted to add an additional element for (Big Dog) does this need to be quoted?
<grammar type="application/x-jsgf">
([Puppy | Dog] {Dog} |
[Cat | Kitten | Kitty] {Cat} |
[Turtle | Tortoise] {Turtle})
</grammar>
Any advise? What am I not getting here?
Thanks in advance.
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Sample Grammar seems flawed
IVR code fix
Hi,
Thanks for pointing this out to us. We will correct this flaw in the IVR documentation. The IVR grammar should look like this:
Here is some sample IVR code you could use to test this out:
petgrammar.php
Note: Using JSGF grammars for examples such as this is good for small-sized grammars. However, for medium to large-sized grammars, you would want to use SRGS+XML grammars as their performance is superior to JSGF grammars.
Hope this helps.
Regards,
Plum Support
Thanks for pointing this out to us. We will correct this flaw in the IVR documentation. The IVR grammar should look like this:
Code: Select all
<grammar type="application/x-jsgf">
(
((Puppy | Dog) {Dog}) |
((Cat | Kitten | Kitty) {Cat}) |
((Turtle | Tortoise) {Turtle})
)
</grammar>
petgrammar.php
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form>
<field name="pet">
<grammar type="application/x-jsgf">
(
((Puppy | Dog) {Dog}) |
((Cat | Kitten | Kitty) {Cat}) |
((Turtle | Tortoise) {Turtle})
)
</grammar>
<prompt>
What pet do you want?
</prompt>
<filled>
<prompt>
You said <value expr="pet"/>.
</prompt>
</filled>
</field>
</form>
</vxml>
Hope this helps.
Regards,
Plum Support
Last edited by support on Wed Feb 17, 2010 12:43 pm, edited 3 times in total.
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
IVR code example in a SRGS+XML format
Hi,
Here is the same IVR code example in a SRGS+XML format:
Hope this helps.
Regards,
Plum Support
Here is the same IVR code example in a SRGS+XML format:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<form>
<field name="pet">
<grammar mode="voice" type="application/srgs+xml" root="petnames">
<rule id="petnames" scope="public">
<one-of>
<item>Dog <tag>pet='Dog'</tag></item>
<item>Puppy <tag>pet='Dog'</tag></item>
<item>Cat <tag>pet='Cat'</tag></item>
<item>Kitten <tag>pet='Cat'</tag></item>
<item>Kitty <tag>pet='Cat'</tag></item>
<item>Turtle <tag>pet='Turtle'</tag></item>
<item>Tortoise <tag>pet='Turtle'</tag></item>
</one-of></rule>
</grammar>
<prompt>
What pet do you want?
</prompt>
<filled>
<prompt>
You said <value expr="pet"/>.
</prompt>
</filled>
</field>
</form>
</vxml>
Regards,
Plum Support
Last edited by support on Mon Jan 11, 2010 12:42 pm, edited 2 times in total.
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
srgs+xml grammar size
Awesome.
You mentioned these Grammars do load fast since there is less processing/pre-parsing required on startup.
Is there a limit on how large these srgs+xml grammars can get? They are much more wordy than the other varieties which support and/or logic in the contexts of the grammar.
Thanks as always.
You mentioned these Grammars do load fast since there is less processing/pre-parsing required on startup.
Is there a limit on how large these srgs+xml grammars can get? They are much more wordy than the other varieties which support and/or logic in the contexts of the grammar.
Thanks as always.
IVR grammar
Hi,
Although SRGS+XML appear to be more wordy than other IVR grammar types, they do process and load faster.
As for a limit to how large these IVR SRGS+XML grammars should be, we recommend that you limit it to a couple hundred entries for good quality performance. Beyond this, you should let us know and we will help you better implement your IVR grammar.
Regards,
Plum Support
Although SRGS+XML appear to be more wordy than other IVR grammar types, they do process and load faster.
As for a limit to how large these IVR SRGS+XML grammars should be, we recommend that you limit it to a couple hundred entries for good quality performance. Beyond this, you should let us know and we will help you better implement your IVR grammar.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com