AppendDictation Method

Microsoft Speech Platform SDK 11

Collapse imageExpand ImageCopy imageCopyHover image

Appends grammar logic to provide access the default, free-text, dictation grammar provided by the Microsoft Speech Platform SDK 11.

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

Visual Basic (Declaration)
Public Sub AppendDictation
Visual Basic (Usage)
Dim instance As GrammarBuilder

instance.AppendDictation()
C#
public void AppendDictation()

Remarks

A GrammarBuilder object that appends a dictation grammar using the AppendDictation()()()() method can be combined with a GrammarBuilder that specifies SemanticResultValue and SemanticResultKey objects.

Examples

The following example creates a Grammar that accepts free-speech dictation. The grammar is constructed from two GrammarBuilder instances; one supports the commands "start dictation" and "stop dictation", the other appends a free-text dictation grammar using the AppendDictation method. The dictation result will be obtainable from the Value property of SemanticValue instance returned with a recognized phrase and accessed with the tag "DictationInput".

C# Copy imageCopy Code
private void freeTextDictation(){
    GrammarBuilder startStop = new GrammarBuilder();
    GrammarBuilder dictation = new GrammarBuilder();
    dictation.AppendDictation();
    
    startStop.Append(new SemanticResultKey("StartDictation", new SemanticResultValue("Start Dictation",true)));
    startStop.Append(new SemanticResultKey("DictationInput", dictation));
    startStop.Append(new SemanticResultKey("StopDictation", new SemanticResultValue("Stop Dictation", false)));
    Grammar grammar=new Grammar(startStop);
    grammar.Enabled=true;
    grammar.Name=" Free-Text Dictation ";
    _recognizer.LoadGrammar(grammar);
   
}

See Also