RecognizerState 枚举

定义

枚举识别器状态的值。Enumerates values of the recognizer's state.

public enum class RecognizerState
public enum RecognizerState
type RecognizerState = 
Public Enum RecognizerState
继承
RecognizerState

字段

Listening 1

识别引擎可接收和分析音频输入。The recognition engine is available to receive and analyze audio input.

Stopped 0

识别引擎不接收或分析音频输入。The recognition engine is not receiving or analyzing audio input.

示例

在下面的示例中, 应用程序在其对StateChanged事件的处理程序的实现中显示识别器的状态。In the example below, an application displays the state of a recognizer in its implementation of a handler for the StateChanged event.

  
_recognizer.StateChanged +=  
    delegate(object sender, StateChangedEventArgs eventArgs) {  
        _recognizerStateLabel.Text = "Speech Recognizer State: " + eventArgs.RecognizerState.ToString();  
    };  
  

注解

RecognizerState为使用SpeechRecognizer访问 Windows 桌面语音识别技术服务的客户端封装默认语音识别引擎的运行状态。RecognizerState encapsulates the running state of the default speech recognition engine for clients using SpeechRecognizer to access the Windows Desktop Speech Recognition Technology service.

应用程序可以通过查询RecognizerState SpeechRecognizer实例上的State属性, 以对象的形式获取桌面识别引擎的当前状态。Applications can obtain the current state of the desktop recognition engine as a RecognizerState object by querying the State property on a SpeechRecognizer instance. 若要在桌面识别引擎发生更改后获取其状态, 应用程序可以查询RecognizerState StateChanged传递给事件StateChangedEventArgs处理程序的对象的属性。To obtain the state of the desktop recognition engine after it changes, applications can query the RecognizerState property of the StateChangedEventArgs object passed to a handler for StateChanged events.

备注

SpeechRecognitionEngine实例在进程内运行, 其运行状态处于应用程序控制之下。SpeechRecognitionEngine instances run in-process and their running state is under the control of the application. 因此, SpeechRecognitionEngine不包含用于RecognizerState返回对象的属性。Therefore, SpeechRecognitionEngine does not contain a property to return a RecognizerState object.

桌面语音识别服务器的状态是只读属性, 无法以编程方式进行控制。The state of a desktop speech recognition server is a read-only property and cannot be controlled programmatically. 用户可以使用语音识别用户界面 (UI) 或通过 Windows "控制面板" 的 "语音识别" 成员来更改共享语音识别器的状态。Users can change a shared speech recognizer's state using the Speech Recognition user interface (UI) or through the Speech Recognition member of the Windows Control Panel.

语音识别 UI 中的 "打开" 和 "睡眠" 设置都Listening对应于状态。Both the On and Sleep settings in the Speech Recognition UI correspond to the Listening state. 语音识别 UI 中的Off设置对应于 "已停止"。The Off setting in the Speech Recognition UI corresponds to Stopped.

Enabled其他属性, 该属性会影响共享语音识别引擎接收和处理语音输入的准备情况。Enabled is the other property that affects the readiness of a shared speech recognition engine to receive and process speech input. 可以使用Enabled控制共享语音识别引擎的语法是否处于活动状态, 以便识别。You can use Enabled to control whether or not a shared speech recognition engine's grammars are active for recognition. 但是, 更改Enabled属性不会RecognizerState对属性产生任何影响。However, changing the Enabled property has no effect on the RecognizerState property.

描述、支持的区域性和音频格式以及识别引擎名称等信息封装在RecognizerInfo类型中。Information such as the description, the supported culture and audio formats, and the recognition engine name is encapsulated in the RecognizerInfo type.

适用于

另请参阅