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)

プロパティ値

ReadOnlyCollection<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 信頼スコアが最も高い語句に関する詳細情報を提供します。

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

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

適用対象

こちらもご覧ください