How to derive a class from StaticGrammarBase

30 Jan

The class StaticGrammarBase is the base class which loads W3C Grxml file to memory for speech recognitions. The base class provides several virtual functions which should be overridden in the derived class. Here are the typical procedures or guidelines recommended:

  1. Derive a class from StaticGrammarBase:

class VerbNounGrammar : StaticGrammarBase


  1. Define a constructor which calls the base class’s constructor:

public VerbNounGrammar(string s, HostInfo host) : base(s,host)



  1. Override the function OnSpeechRecognized to dig out the recognition results:

protected override void OnSpeechRecognized(object sender, SpeechRecognizedEventArgs e)


string SpokenText = e.Result.Text;
string VerbTag = e.Result.Semantics[“Verb”].Value.ToString();
string NounTag = e.Result.Semantics[“Noun”].Value.ToString();


That is it.

Leave a comment

Posted by on January 30, 2008 in CAD


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: