Share via


Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

GrammarBuilder.AppendDictation Method

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)


Public Sub AppendDictation
Dim instance As GrammarBuilder

public void AppendDictation()


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


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”.

private void freeTextDictation(){
    GrammarBuilder startStop = new GrammarBuilder();
    GrammarBuilder dictation = new GrammarBuilder();
    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.Name=" Free-Text Dictation ";

See Also


GrammarBuilder Class

GrammarBuilder Members

AppendDictation Overload

Microsoft.Speech.Recognition Namespace