SpeechUI 类

定义

在语音平台用户界面中显示的标识操作提供文本和状态信息。Provides text and status information on recognition operations to be displayed in the Speech platform user interface.

public ref class SpeechUI
public class SpeechUI
type SpeechUI = class
Public Class SpeechUI
继承
SpeechUI

示例

下面的示例是事件的处理程序 SpeechRecognizedThe following example is a handler for the SpeechRecognized event. 此事件由 Grammar 设计用于处理密码输入(格式为 "我的密码 ...")的使用。This event is used by a Grammar that is designed to handle password input in the form "My password is …".

如果密码不存在或无效,则 SendTextFeedback 将错误信息发送到语音平台用户界面。If a password is not present, or not valid, SendTextFeedback sends error information to the Speech platform user interface.

grammar.SpeechRecognized +=   
delegate(object sender, SpeechRecognizedEventArgs eventArgs)   
{  
  SemanticValue semantics = eventArgs.Result.Semantics;  
  RecognitionResult result=eventArgs.Result;  

  if (!semantics.ContainsKey("Password"))   
  {  
    SpeechUI.SendTextFeedback(eventArgs.Result, "No Password Provided", false);  
  }  
  else   
  {  
    RecognizedAudio pwdAudio = result.GetAudioForWordRange(  
                  result.Words[3],  
                  result.Words[result.Words.Count - 1]);  
    MemoryStream pwdMemoryStream = new MemoryStream();  
    pwdAudio.WriteToAudioStream(pwdMemoryStream);  
    if (!IsValidPwd(pwdMemoryStream))   
    {  
      string badPwd = System.IO.Path.GetTempPath() +   
              "BadPwd" + (new Random()).Next().ToString() + ".wav";  
      FileStream waveStream = new FileStream(badPwd, FileMode.Create);  
      pwdAudio.WriteToWaveStream(waveStream);  
      waveStream.Flush();  
      waveStream.Close();  
      SpeechUI.SendTextFeedback(eventArgs.Result, "Invalid Password", false);  
    }  
  }  
};  

注解

类的成员 SpeechUI 可用于通过语音识别用户界面向最终用户指示准确的反馈。The members of the SpeechUI class can be used to indicate exact feedback to the end user through the speech recognition user interface. 应用程序可以使用此类返回任意文本和成功/失败信息。An application can return arbitrary text and success/failure information using this class.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
SendTextFeedback(RecognitionResult, String, Boolean)

将有关识别操作状态的状态和描述性文本发送到语音平台用户界面。Sends status and descriptive text to the Speech platform user interface about the status of a recognition operation.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于