Partager via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SpeechHypothesizedEventArgs Class

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Provides data for the SpeechHypothesized event.

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.Speech.Recognition.RecognitionEventArgs
      Microsoft.Speech.Recognition.SpeechHypothesizedEventArgs

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class SpeechHypothesizedEventArgs _
    Inherits RecognitionEventArgs
'Usage
Dim instance As SpeechHypothesizedEventArgs
[SerializableAttribute]
public class SpeechHypothesizedEventArgs : RecognitionEventArgs

Remarks

An instance of SpeechHypothesizedEventArgs is created when the SpeechRecognitionEngine object raises the SpeechHypothesized event. To obtain detailed information about a tentatively recognized phrase, access the Result property in the handler for the event.

Numerous SpeechHypothesized events are generated as a recognition engine attempts to identify an input phrase. Typically, handling these events is only useful for debugging.

SpeechHypothesizedEventArgs derives from RecognitionEventArgs.

Examples

In the example below, a delegate is defined to use the instance of SpeechHypothesizedEventArgs passed to the handler for SpeechHypothesized events to display information about a tentatively recognized phrase.

// Create a handler for the SpeechHypothesized event.
recognizer.SpeechHypothesized += new EventHandler<SpeechHypothesizedEventArgs>(recognizer_SpeechHypothesized);

// Handle the event and display the hypothesized result.
void recognizer_SpeechHypothesized (object sender, SpeechHypothesizedEventArgs e)
  {
    Console.WriteLine("Hypothesized text: " + e.Result.Text);
  }

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SpeechHypothesizedEventArgs Members

Microsoft.Speech.Recognition Namespace

RecognitionEventArgs

Result

SpeechRecognized

SpeechRecognizedEventArgs