Specifying and Testing User Input
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
User input in voice-only applications can consist of the words or phrases a user speaks into a telephone or the keypresses on a numeric keypad. The guidelines that specify what words or phrases a user can say or the keypresses a user can enter are defined using speech recognition grammars. Speech grammars define the words or phrases users can speak and dual tone multi-frequency (DTMF) grammars define the keypresses users can enter.
Use the Input panels of the QA Property Builder to associate both speech and DTMF grammars with a QA control, test sample phrases and keypresses against the grammars, and specify speech and DTMF time-out properties.
To associate a new speech or DTMF grammar file with a QA control
Right-click a QA control on an .aspx page, and then click Property Builder to open the General panel of the QA Property Builder.
In the tree view pane, click General under the Input heading, and then do one of the following:
- For a new speech grammar, click the Grammar tab, and then click Add New Grammar.
- For a new DTMF grammar, click the DTMF tab, and then click Add New Grammar.
In the Add New Grammar dialog box, enter a unique ID for the new grammar file, and then click OK.
In the Add New Grammar File dialog box, browse to the correct location, and then click Save.
Click Apply to save changes.
To associate an existing speech or DTMF grammar file with a QA control
Right-click a QA control on an .aspx page, and then click Property Builder to open the General panel of the QA Property Builder.
In the tree view pane, click General under the Input heading, and then do one of the following:
- For an existing speech grammar, click the Grammar tab, and then click Add Existing Grammar.
- For an existing DTMF grammar, click the DTMF tab, and then click Add Existing Grammar.
In the Add Existing Grammar dialog box, type a unique ID for this grammar file, and then click Browse.
In the Grammar URL browser dialog box, click the file type for the existing grammar file (.cfg, .xml, or .grxml), and then click a URL type (Absolute, Document Relative, or Root Relative).
If the grammar file exists outside the current project, click Browse to locate the file, and then click Open.
Note
Speech Server does not support grammar Uniform Resource Identifiers (URIs) with the scheme "file." Including grammar paths that contain the "file" scheme can lead to unexpected behavior when the application is deployed. Developers should move grammar files into the current project before adding them to a QA control.
Click OK.
In the Add Existing Grammar dialog box, specify the active or root rule that applies to this QA control.
Note
Speech Control Editor does not validate grammar files when developers associate them with a QA control. Speech Control Editor attempts to resolve the specified URI to a local path and then does one of the following:
- If the URI is successfully resolved to a local path, but the specified file does not exist at the URI, a warning message appears stating that unexpected behavior can result if the file is added. Developers can bypass the warning and continue adding the file.
- If the URI is not successfully resolved to a local path, Speech Control Editor does not verify whether the file is actually present at the specified URI.
Note
It is not necessary to add a grammar library file directly to a QA control. Specifying a grammar library in the QA control can cause undefined behavior when the application is deployed. If using the Voice Response Web Application Project Wizard to create a project, the system automatically adds a copy of the Cmnrules.grxml file, named Library.grxml, to the project.
To delete a speech or DTMF grammar associated with a QA control
Right-click a QA control on an .aspx page, and then click Property Builder to open the General panel of the QA Property Builder.
In the tree view pane, click General under the Input heading, and then do one of the following:
- For a speech grammar, click the Grammar tab, click the grammar file to delete, and then click Delete Grammar.
- For a DTMF grammar, click the DTMF tab, click the grammar file to delete, and then click Delete Grammar.
For grammar files, the name of the grammar file to edit appears in Grammar Explorer. For inline grammars, the inline grammar template appears in the Edit Grammar window.
Note
Editing a grammar file requires Property Builder to close and save all changes.
Testing User Responses Against Speech or DTMF Grammars
Use the XPathTrigger Sample Sentence tool to test sample phrases or keypresses against a grammar associated with a control and to identify the path through the grammar that creates the resulting Semantic Markup Language (SML). The tool performs this test without opening Speech Grammar Editor.
To test words, phrases, or keypresses against a speech or DTMF grammar
Right-click a QA control on an .aspx page, and then click Property Builder to open the General panel of the QA Property Builder.
In the tree view pane, click General under the Input heading.
Associate a new grammar file, a new inline grammar, or an existing grammar file with the QA control, and then do one of the following:
- To test against speech grammars, click the Grammar tab, and then click XPathTrigger Sample Sentence Tool.
- To test against DTMF grammars, click the DTMF tab, and then click XPathTrigger Sample Sentence Tool.
In the Sample speech input box, do one of the following:
- For speech grammars, type the words or phrases to test against the associated speech grammars, and then click Go.
- For DTMF grammars, type the keypresses to test against the associated DTMF grammars, and then click Go.
If the grammars are able to recognize the words, phrases, or keypresses, the resulting SML appears in the window below the Sample speech input box.
Note
The city and day SML nodes were created by adding semantic interpretation information to the rule elements that define these items.
If the grammars are not able to recognize the words, phrases, or keypresses, the application displays a window containing the following error message: The sample text 'input' was not found in any of the speech grammars in the control. Check that you have the correct root rule set.
Handling User Input
The way an application handles a user's spoken input depends on whether the application implements a system-initiative or mixed-initiative dialog style.
If using the system-initiative dialog style, the application accepts only one answer in response to a question. Associate a QA control with Answers and Confirms to recognize and confirm the user's response.
If using mixed-initiative dialog style, the application accepts an answer in response to a specific question, but it can also accept extra answers that apply to questions the application has not asked yet. Associate a QA control with Answers, Extra Answers, and Confirms to recognize and confirm the user's response.
For more information about handling user input, see Speech Controls in SALT Voice Response Application Projects.
Specifying Time-out Properties
Specify input time-out properties for both speech and DTMF grammars so that speech applications accept pauses in user responses and thereby promote natural speech patterns.
To specify input time-out properties for speech input
Right-click a QA control on an .aspx page, and then click Property Builder to open the General panel of the QA Property Builder.
In the tree view pane, click Speech Time-outs under the Input heading to open the Speech Time-outs Properties panel.
Type any relevant time-out values for the listed properties.
To specify input time-out properties for DTMF input
Right-click a QA control on an .aspx page, and then click Property Builder to open the General panel of the QA Property Builder.
In the tree view pane, click DTMF Properties under the Input heading to open the DTMF Properties panel.
Type any relevant time-out values for the listed time-out properties, and then enter the names of any client-side event handlers that are called when the specified event occurs.
See Also
Other Resources
Design Dialog Flow
Create SALT Voice Response Application Projects