次の方法で共有


RecognitionResult.Alternates プロパティ

定義

音声レコグナイザーへの入力に対する一致候補のコレクションを取得します。

public:
 property System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::Recognition::RecognizedPhrase ^> ^ Alternates { System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::Recognition::RecognizedPhrase ^> ^ get(); };
public System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Recognition.RecognizedPhrase> Alternates { get; }
member this.Alternates : System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Recognition.RecognizedPhrase>
Public ReadOnly Property Alternates As ReadOnlyCollection(Of RecognizedPhrase)

プロパティ値

認識代替の読み取り専用コレクション。

次の例は、 イベントの SpeechRecognized ハンドラーと、関連付けられている RecognitionResultに関する情報の一部を示しています。

// Handle the SpeechRecognized event.   
void SpeechRecognizedHandler(object sender, SpeechRecognizedEventArgs e)  
{  
  if (e.Result == null) return;  

  // Add event handler code here.  

  // The following code illustrates some of the information available  
  // in the recognition result.  
  Console.WriteLine("Grammar({0}), {1}: {2}",  
    e.Result.Grammar.Name, e.Result.Audio.Duration, e.Result.Text);  

  // Display the semantic values in the recognition result.  
  foreach (KeyValuePair<String, SemanticValue> child in e.Result.Semantics)  
  {  
    Console.WriteLine(" {0} key: {1}",  
      child.Key, child.Value.Value ?? "null");  
  }  
  Console.WriteLine();  

  // Display information about the words in the recognition result.  
  foreach (RecognizedWordUnit word in e.Result.Words)  
  {  
    RecognizedAudio audio = e.Result.GetAudioForWordRange(word, word);  
    Console.WriteLine(" {0,-10} {1,-10} {2,-10} {3} ({4})",  
      word.Text, word.LexicalForm, word.Pronunciation,  
      audio.Duration, word.DisplayAttributes);  
  }  

  // Display the recognition alternates for the result.  
  foreach (RecognizedPhrase phrase in e.Result.Alternates)  
  {  
    Console.WriteLine(" alt({0}) {1}", phrase.Confidence, phrase.Text);  
  }  
}  

注釈

認識 Alternates は、プロパティ Confidence の値によって順序付けられます。 特定の語句の信頼度値は、語句が入力と一致する確率を示します。 信頼度が最も高い語句は、入力と一致する可能性が最も高い語句です。

Confidence 値は、他 Alternatesの の信頼値を参照せずに、個別に評価する必要があります。 が RecognitionResult 継承するプロパティは、 RecognizedPhrase 最も高い信頼度スコアを持つフレーズに関する詳細情報を提供します。

コレクションの用途の Alternates 1 つは、自動エラー修正です。 たとえば、ディレクトリ ダイアログを設計するときに、アプリケーションが認識イベントの正しい情報を持っているかどうかをユーザーに確認するように求めるメッセージが表示される場合があります(例: "Anna" と言いましたか?ユーザーが "いいえ" と言った場合、アプリケーションは、十分 Confidence なスコアが高い代替候補についてユーザーにクエリを実行できます。

音声認識と認識代替手段の使用の詳細については、「 音声認識 」と「 音声認識イベントの使用」を参照してください。

適用対象

こちらもご覧ください