Aracılığıyla paylaş


Grammar.SpeechRecognized Olay

Tanım

Konuşma tanıyıcı nesne kullanarak Grammar tanıma gerçekleştirdiğinde tetiklenen.

public:
 event EventHandler<System::Speech::Recognition::SpeechRecognizedEventArgs ^> ^ SpeechRecognized;
public event EventHandler<System.Speech.Recognition.SpeechRecognizedEventArgs> SpeechRecognized;
member this.SpeechRecognized : EventHandler<System.Speech.Recognition.SpeechRecognizedEventArgs> 
Public Custom Event SpeechRecognized As EventHandler(Of SpeechRecognizedEventArgs) 
Public Event SpeechRecognized As EventHandler(Of SpeechRecognizedEventArgs) 

Olay Türü

Örnekler

Aşağıdaki örnekte, nesnenin olayı için bir olay işleyicisi Grammar kullanımı gösterilmektedir SpeechRecognized . Tanıma sonuçlarını konsola gönderir.

public partial class Form1 : Form
{
  SpeechRecognitionEngine sre;

  public Form1()
  {
  InitializeComponent();

  // Create an in-process speech recognizer.
  sre = new SpeechRecognitionEngine();

  // Configure input to the speech recognizer.
  sre.SetInputToDefaultAudioDevice();

  // Create a simple grammar and load it.
  Grammar testGrammar = new Grammar(new GrammarBuilder("testing"));
  sre.LoadGrammarAsync(testGrammar);

  // Add a handler for the grammar's speech recognized event.
  testGrammar.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(testGrammar_SpeechRecognized);

  // Start asynchronous speech recognition.
  sre.RecognizeAsync();
  }

  // Handle the grammar's SpeechRecognized event, output the recognized text.
  void testGrammar_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
  {
    Console.WriteLine("Recognized text: " + e.Result.Text);
  }
}

Açıklamalar

Konuşma tanıma, girişi tanıdığında da bir SpeechRecognized olay oluşturur. Nesnenin GrammarSpeechRecognized olayı, konuşma tanıyıcısının SpeechRecognized olayından önce oluşturulur. Daha fazla bilgi için bkz SpeechRecognizer.SpeechRecognized. , SpeechRecognitionEngine.SpeechRecognizedve RecognizeCompleted olayları.

Belirli bir dilbilgisine özgü tüm görevler her zaman nesnenin GrammarSpeechRecognized olayı için işleyiciler tarafından işlenmelidir.

Şunlara uygulanır

Ayrıca bkz.