SrgsGrammarMode Enum

Definition

Indicates the type of input that the grammar, defined by the SrgsDocument, will match.

public enum SrgsGrammarMode
Inheritance
SrgsGrammarMode

Fields

Name Value Description
Voice 0

The SrgsDocument object will match speech input.

Dtmf 1

The SrgsDocument object will match DTMF tones similar to those found on a telephone, instead of speech.

Examples

string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");  
SrgsDocument document = null;  
GrammarBuilder builder = null;  
Grammar grammar = null;  

Choices firstThree = new Choices(new string[] {"1", "2", "3"});  
Choices nextThree = new Choices(new string[] {"4", "5", "6"});  
Choices lastThree = new Choices(new string[] {"7", "8", "9"});  

Choices keyPadChoices = new Choices(new GrammarBuilder[] {firstThree, nextThree, lastThree, new Choices("0")});  

builder = new GrammarBuilder(keyPadChoices);  
document = new SrgsDocument(builder);  

document.Mode = SrgsGrammarMode.Dtmf;  
grammar = new Grammar(document);   

Remarks

The input mode for an SrgsDocument is determined by its Mode property. The default input mode is Voice, which indicates that the grammar defined by the SrgsDocument will match speech input.

The Dtmf mode indicates that a grammar will match Dual-Tone Multi-Frequency (DTMF) tones instead of speech. There are 16 DTMF tones, 12 of which are commonly found on most telephones.

When you create a Grammar object from an SrgsDocument, the Grammar object will match the type of input specified by the Mode property, which gets an instance of SrgsGrammarMode.

Applies to

产品 版本
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

See also