Feedback

  • Contents
 

Reference Built-in Grammars Instead of Recreating Functionality

Built-in grammars provide speech recognition in an Interactive Voice Response (IVR) application for basic responses; however, you do not have control over the data that built-in grammars return. For this purpose, you may need to create your own custom grammars to provide that information, such as specifying account numbers, identification numbers, or other specific information in a certain format with a set amount of data. In custom grammars, you can refer to built-in grammars that already provide the required speech recognition functionality.

For example, if you wanted callers to speak the number of animals seen during a recent hike, you could create a custom grammar to specify that it uses the built-in number grammar appended with any entries that you define in the custom grammar. Instead of recreating the functionality of number recognition in the custom grammar, you can reference the number built-in grammar, as displayed in the following example grammars.

ABNF built-in grammar reference example

#ABNF 1.0;
language en-us;
mode voice;
tag-format <semantics/1.0>;
root $wildlife;
$wildlife=
$number $type {out.number=rules.number; 
 
out.type=rules.type;};
$type=
((bird | birds) {out="birds";} 
 
|
fish {out="fish";} |
(mammal | mammals) {out="mammals";} 
 
|
(animal | animals) {out="animals";});
$number=
$<builtin:grammar/number>;

GrXML built-in grammar reference example

<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xml:lang="en-US"
root="wildlife"
mode="voice">
<rule id="wildlife">
<ruleref 
 
uri="#number" />
<ruleref uri="#type" 
 
/>
<tag>out.number=rules.number;</tag>
<tag>out.type=rules.type;</tag>
</rule>
<rule id="type">
<one-of>
<item>
<one-of>
<item>bird</item>
<item>birds</item>
</one-of>
<tag>out="birds";</tag>
</item>
<item>fish 
 
<tag>out="fish";</tag></item>
<item>
<one-of>
<item>mammal</item>
<item>mammals</item>
</one-of>
<tag>out="mammals";</tag>
</item>
<item>
<one-of>
<item>animal</item>
<item>animals</item>
</one-of>
<tag>out="animals";</tag>
</item>
</one-of>
</rule>
<rule id="number">
<ruleref 
 
uri="builtin:grammar/number" />
</rule>
</grammar>