The VoiceXML 2.0 specification includes a set of built-in grammars as a convenience to enable developers to get started writing more complex VoiceXML applications quickly. The following basic grammars are built into all standard VoiceXML interpreters:
| Grammar Type | Description |
Recognizes a telephone number adhering to the North American Dialing Plan (with no extension). |
|
Note: All standard built-in grammars are supported in the Spanish language. Currently there are no extended built-in grammars for Spanish. Neither standard nor extended built-in grammars are currently supported in French Canadian. All extended built-in grammars are supported only in English. If you specify a language other than English and refer to an unsupported built-in grammar, a parse error error.unsupported.builtin is thrown.
In addition, BeVocal VoiceXML contains a set of extended built-in grammars, so VoiceXML developers can reference these quite complex grammars which have been tuned over the years by caller usage. The extended grammars are:
You can reference a built-in grammar in one of following ways:
| | You can use any built-in grammar (standard or BeVocal VoiceXML extension) in a <grammar> element by specifying the src attribute with a URI of one of these forms: |
builtin:grammar/ | |
| See Parameterizing Grammars for information on grammar parameters. For example: | |
<grammar src="builtin:grammar/number" /> | |
| This is the preferred method for referencing all built-in grammars. | |
| | You can use standard built-in dtmf-only grammars in a <grammar> element by specifying the src attribute with a URI of the form: |
| |
Currently, the boolean, digits, number, and date built-in grammars are supported for dtmf-only. For other built-in grammars, such as phone, currency, and time, a warning is thrown that the dtmf-only version is not supported, and the regular grammar (voice and dtmf) is used. Other built-in grammars may be supported as dtmf-only in a future release. | |
| | You can use any built-in grammar (standard or BeVocal VoiceXML extension) in a <grammar> element by specifying the expr attribute with a JavaScript expression that evaluates to a URI of one of the forms specified above. For example: |
<var name="numgram" value="'builtin:grammar/number'" /> <grammar expr="numgram" /> | |
| | You can use a standard built-in grammar as the value of the type attribute of a <field> element. For example: |
<field name="num" type="number"> | |
| This means that the speech-recognition engine tries to interpret what the user says as a number. |
See Setting Input Variables for a general description of how the interpreter uses recognition results to fill input variables. Most built-in grammars, such as phone, return a simple text string, which is used to fill a single slot whose name is the same as the grammar name. For example, the date grammar sets a slot named date. However, some of the more complex grammars provide a semantic interpretation that can fill in multiple slots; for example, airline sets code and name.
The following table lists the properties for the extended built-in grammars which provide a complex semantic interpretation.
| Field Type | Properties | ||||||||||||||||||||||||
airport |
|
||||||||||||||||||||||||
airline |
|
||||||||||||||||||||||||
citystate |
|||||||||||||||||||||||||
datetime |
The following examples show utterances and the corresponding slots that are filled:
"four twenty-two p m on november thirtieth"
"in one hour and fifteen minutes"
|
||||||||||||||||||||||||
equity |
|
||||||||||||||||||||||||
stockindex |
|
||||||||||||||||||||||||
street |
|||||||||||||||||||||||||
streetaddress |
|
A property is accessed with an expression of the form:
fieldName.propertyName
For example the city property of a citystate field is accessed as follows:
<field name="mycity">
<grammar src="builtin:grammar/citystate"/>
<filled>
<prompt>The city is <value expr="mycity.city"/>
</filled>
</field>
Two standard built-in grammars, digits and boolean, can be parameterized. Specifically, you can set limits on the length of a digit string, and you can set DTMF key presses to mean yes or no. In addition, you must specify the city and state with the street built-in grammar; you can optionally specify the county to disambiguate a case in which the state contains two cities with the same name.
The following table shows the built-in grammars that can be parameterized and indicates which parameters are required.
You express parameter information using URI-style query syntax of the form:
builtin:grammar/typeName?parameter=value
For example, the grammar matches a sequence of exactly five digits:
<grammar src="builtin:grammar/digits?length=5">
You can specify more than one parameter, separated by semicolons. For example, the following grammar allows a user to press 7 for an affirmative answer and 9 for a negative answer:
<grammar src="builtin:grammar/boolean?y=7;n=9"/>
Note: The interpreter throws a error.badfetch event if it loads a VoiceXML file that contains a built-in grammar with an unrecognized parameter or with inconsistent parameters, such as:
<!-- ERROR: Inconsistent parameters for built-in grammar--> <grammar src="builtin:grammar/digits?minlength=5;maxlength=1">
The following table shows example user inputs for each extended built-in grammar.
| Grammar Type | Example Inputs |
airport |
|
airline |
|
datetime |
|
equity |
|
stockindex |
|
street |
|
streetaddress |
|
citystate |
In VoiceXML 2.0 the field's type attribute no longer defines an implicit <say-as> type to output the field's value. Instead it plays the value in normal TTS. You must now use the type attribute of <say-as> for a type-specific read-out of the value (in TTS).
The bevocal:mode attribute of <say-as> can be used to define recorded output for some types. See the <say-as> tag for details.
| Grammar Type | Say-As Type | Audio Output | String Result |
airport |
airport |
||
airline |
airline |
||
equity |
equity |
||
stockindex |
stockindex |
||
street |
street |
||
streetaddress |
address |
||
citystate |
citystate |
| Café Home |
Developer Agreement |
Privacy Policy |
Site Map |
Terms & Conditions Part No. 520-0004-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL |