Sun Java System Portal Server Mobile Access 7.1 Developer's Guide

Grammar Translation

VoiceXML applications use grammars to define the phrases that users can speak in any given dialog. For example, when logging into the Portal Server 7.1 software, users are prompted to enter an account number. In this case, the grammar allows users to speak a sequence of numbers. Once logged in, users can access a channel by speaking the channel name, such as email.

In VoiceXML applications, grammars can be included inline in the VoiceXML dialog code, for example:


<link next="#goodBye">
    <grammar scope="dialog">
         [
            ( goodbye )
            ( exit )
            ( quit )
         ]
    </grammar
</link>

The other option is to store the grammars in a file and reference that file form the VoiceXML dialog.

For example:


<form id="channelcommand">
    <field name="action" slot="action">
    <grammar src="grammars/overview.grammar#NextAction"/>

In this case the grammar is located in the file grammars/overview.grammar.

Voice applications, such as Personal Notes and Bulletin Board, generally use inline grammars. However, external grammar files can also be used as well.

For external grammar files, localization involves replacing the English words or phrases in the grammar file with their equivalents in the new language. Do not simply replace words with their dictionary equivalents. Instead, choose words or phrases that native language speakers would use in every day conversation.

When several ways of saying the same thing are available, include these alternatives in the grammar. For example, in the previous example, users can exit by saying goodbye, exit, or quit.

For inline grammars, you must identify which files contain inline grammars. Search for files that contain the string <grammar> but do not include a src= parameter (which indicates an external grammar file). Replace the words or phrases as you would in the case of external grammar file, but be careful not to inadvertently modify other parts of the VoiceXML code.