title: Speech recognition program is randomly displaying pre-defined word(defined in 'GramarBuilder()') for those spoken words that doesn't exist in Grammar
body: <p>I'm a novice to C# i'm not sure if I'm writing on the right forum. I am building simple speech recognition program which takes voice command as input, performs speech to text translation and then searches a video matching to that text. </p>
  
  <blockquote>
    <p>I am using <code>grammarBuider()</code> and define my own grammar for more
    accurate speech recognition. But the problem is: when any word that
    doesn't exit in grammar is spoken, the program starts
    any displaying/writing existing word randomly which were defined in
    grammar.</p>
  </blockquote>
  
  <p>So,  </p>
  
  <blockquote>
    <p>What I want is: If any word that doesn't exist in my grammar <code>Grammarbuilder</code> is spoken, the program should not write any or any random word from grammar on screen. Instead, it should display a message to user i.e. "word you spoke doesn't exist in program's grammar OR no video found matching to your voice search"</p>
  </blockquote>
  
  <p>Could anyone advise me How can I fix this problem?
  Here is my code.. </p>
  
  <pre><code>   public Form1()
      {
          InitializeComponent();
      }
  
  
      private void btnStart_Click(object sender, EventArgs e)
      {
          btnStart.Enabled = false;
              btnStop.Enabled = true;
              clist.Add(new string[] { "go away", "able", "active", "actual", "afraid", "busy", "casual" });
              Grammar gr = new Grammar(new GrammarBuilder(clist));
              try
              {
                  sre.RequestRecognizerUpdate();
                  sre.LoadGrammar(gr);
                  sre.SpeechRecognized+= sre_SpeechRecognized;
                  sre.SetInputToDefaultAudioDevice();
                  sre.RecognizeAsync(RecognizeMode.Multiple);
  
  
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message, "Error");
  
              }
  
      }
          void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
          {
              textBoxContent.Text += e.Result.Text.ToString() + Environment.NewLine;     
  
  
          }
  
      private void btnStop_Click(object sender, EventArgs e)
      {
  
              sre.RecognizeAsyncStop();
              btnStart.Enabled = true;
              btnStop.Enabled = false;
  
      }
  }
  </code></pre>