Voice.unloadGrammars()

Overview

Stops the engine from listening for the terms in the specified grammar file or files.

Added in version 1.2.104

Use Cases

You want to stop speech recognition for specific grammars.

Remarks

You cannot remove grammars that handle the default voice-enabled shortcuts in context menus.

Format

Voice.unloadGrammars(grammar);

Parameter Description Type Required Notes
grammar File name of a BNF resource. String Required To remove more than one grammar at a time, separate the names with a comma. You do not need to specify the file extension.

Example 1

Copy
/* Removing one grammar
 */
 
 Voice.loadGrammars('connected_digits');
.
.
.
Voice.unloadGrammars('connected_digits');

Example 2

Copy
/* Removing more than one grammar
 */
 
 Voice.loadGrammars('connected_digits', 'yes_no');
.
.
.
Voice.unloadGrammars('connected_digits', 'yes_no');