RecognitionResult.Alternates プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
音声認識エンジンへの入力に一致する可能性のあるコレクションを取得します。
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 スコアを持つ代替候補についてユーザーにクエリを実行できます。