RecognitionResult.Alternates Propriedade
Definição
Obtém a coleção de possíveis correspondências para a entrada para o reconhecedor de fala.Gets the collection of possible matches for input to the speech recognizer.
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)
Valor da propriedade
Uma coleção somente leitura das alternativas de reconhecimento.A read-only collection of the recognition alternates.
Exemplos
O exemplo a seguir mostra um manipulador para o SpeechRecognized evento e algumas das informações sobre o associado RecognitionResult .The following example shows a handler for the SpeechRecognized event and some of the information about the associated 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);
}
}
Comentários
AlternatesO reconhecimento é ordenado pelos valores de suas Confidence Propriedades.Recognition Alternates are ordered by the values of their Confidence properties. O valor de confiança de uma determinada frase indica a probabilidade de que a frase corresponda à entrada.The confidence value of a given phrase indicates the probability that the phrase matches the input. A frase com o valor de maior confiança é a frase que provavelmente corresponde à entrada.The phrase with the highest confidence value is the phrase that most likely matches the input.
Cada Confidence valor deve ser avaliado individualmente e sem referência aos valores de confiança de outros Alternates .Each Confidence value should be evaluated individually and without reference to the confidence values of other Alternates. As propriedades RecognitionResult herdadas do RecognizedPhrase fornecem informações detalhadas sobre a frase com a pontuação de confiança mais alta.The properties that the RecognitionResult inherits from RecognizedPhrase provide detailed information about the phrase with the highest confidence score.
Um uso para a Alternates coleção é para a correção de erro automatizada.One use for the Alternates collection is for automated error correction. Por exemplo, ao criar uma caixa de diálogo de diretório, um aplicativo pode solicitar que o usuário Verifique se o aplicativo tem as informações corretas de um evento de reconhecimento, como em, "você disse" Anna "?" Se o usuário disser "não", o aplicativo poderá consultar o usuário sobre as alternativas que tinham uma pontuação alta o suficiente Confidence .For example, when designing a directory dialog, an application could prompt the user to check if the application has the correct information from a recognition event, as in, "Did you say 'Anna'?" If the user says "no", then the application could query the user about any alternates that had a high enough Confidence score.
Para obter mais informações sobre o reconhecimento de fala e o uso de alternativas de reconhecimento, consulte reconhecimento de fala e uso de eventos de reconhecimento de fala.For more information about speech recognition and the use of recognition alternates, see Speech Recognition and Using Speech Recognition Events.