RecognitionEventArgs クラス

定義

音声認識イベントに関する情報を提供します。

public ref class RecognitionEventArgs abstract : EventArgs
[System.Serializable]
public abstract class RecognitionEventArgs : EventArgs
[<System.Serializable>]
type RecognitionEventArgs = class
    inherit EventArgs
Public MustInherit Class RecognitionEventArgs
Inherits EventArgs
継承
RecognitionEventArgs
派生
属性

次の例では、音声認識エンジンの 、SpeechRecognizedSpeechHypothesizedおよび SpeechRecognitionRejected イベントのハンドラーをアタッチします。 3 つのイベントのイベント引数の型はすべて から RecognitionEventArgs派生します。これはハンドラーのイベント データ パラメーターとして使用されます。

// Initialize the speech recognizer.  
private void Initialize(SpeechRecognitionEngine recognizer)  
{  
  // Attach handlers for the SpeechHypothesized, SpeechRecognitionRejected,  
  // and SpeechRecognized events.  
  recognizer.SpeechHypothesized +=  
    new EventHandler<SpeechHypothesizedEventArgs>(DisplayResult);  
  recognizer.SpeechRecognitionRejected +=  
    new EventHandler<SpeechRecognitionRejectedEventArgs>(DisplayResult);  
  recognizer.SpeechRecognized +=  
    new EventHandler<SpeechRecognizedEventArgs>(DisplayResult);  

  // Add other initialization code here.  
}  

// Handle the SpeechHypothesized, SpeechRecognitionRejected,  
// and SpeechRecognized events.  
private void DisplayResult(object sender, RecognitionEventArgs e)  
{  
  if (e is SpeechHypothesizedEventArgs)  
  {  
    Console.WriteLine("Speech hypothesized:");  
  }  
  else if (e is SpeechRecognitionRejectedEventArgs)  
  {  
    Console.WriteLine("Speech recognition rejected:");  
  }  
  else if (e is SpeechRecognizedEventArgs)  
  {  
    Console.WriteLine("Speech recognized:");  
  }  

  // Add code to handle the event.  
}  

注釈

プロパティは Result 、認識情報をオブジェクトとして RecognitionResult 取得します。 音声認識イベントの詳細については、「音声認識イベントの 使用」を参照してください。

RecognitionEventArgs は、次のクラスの基本です。

RecognitionEventArgs は、EventArgs から派生します。

プロパティ

Result

音声認識イベントに関連付けられている認識結果データを取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください