GrammarBuilder Constructor ()

Default constructor for the GrammarBuilder object.

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

Syntax

'Declaration
Public Sub New
public GrammarBuilder ()
public:
GrammarBuilder ()
public GrammarBuilder ()
public function GrammarBuilder ()

Remarks

Constructs an empty GrammarBuilder object. To have further content will require using one of the overloads for the Append methods.

Example

The example routine below initializes four instance of GrammarBuilder using the default construct, and then appends System.String, SemanticResultValue and SemanticResultKey objects to create a Grammar.

private void LoadHelloWorld2() {
    GrammarBuilder gb = new GrammarBuilder();
    GrammarBuilder gb1 = new GrammarBuilder();
    GrammarBuilder gb2 = new GrammarBuilder();
    GrammarBuilder gb3 = new GrammarBuilder();
    gb.Append(new SemanticResultValue("val"));
    
    gb.Append("Hello");
    gb.Append(new SemanticResultKey("key1", new SemanticResultValue(13.6)));
    gb1.Append("world");
    gb1.Append(new SemanticResultKey("key2", new SemanticResultValue(true)));
    gb.Append(new SemanticResultKey("inner", gb1));
    gb3.Append("Hello world");
    gb2.Append(new SemanticResultKey("main", gb3));
    Grammar grammar = new Grammar(gb2);
    grammar.Name = "Hello world.";
    _recognizer.LoadGrammar(grammar);
}

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

GrammarBuilder Class
GrammarBuilder Members
Microsoft.Speech.Recognition Namespace