System.Speech.Recognition 命名空间
包含用于实现语音识别的 Windows 桌面语音技术类型。 Contains Windows Desktop Speech technology types for implementing speech recognition.
类
| AudioLevelUpdatedEventArgs |
为 SpeechRecognizer 或 SpeechRecognitionEngine 类的 |
| AudioSignalProblemOccurredEventArgs |
提供 SpeechRecognizer 或 SpeechRecognitionEngine 的 |
| AudioStateChangedEventArgs |
为 SpeechRecognizer 或 SpeechRecognitionEngine 类的 |
| Choices |
表示一组在语音识别语法约束的选择。Represents a set of alternatives in the constraints of a speech recognition grammar. |
| DictationGrammar |
表示用于自由文本口述的语音识别语法。Represents a speech recognition grammar used for free text dictation. |
| EmulateRecognizeCompletedEventArgs |
为 SpeechRecognizer 和 SpeechRecognitionEngine 类的 |
| Grammar |
引用语音识别语法的运行时对象,应用程序可以用之来定义语音识别的约束。A runtime object that references a speech recognition grammar, which an application can use to define the constraints for speech recognition. |
| GrammarBuilder |
提供机制以便以编程方式为语音识别语法生成约束。Provides a mechanism for programmatically building the constraints for a speech recognition grammar. |
| LoadGrammarCompletedEventArgs |
为 SpeechRecognizer 或 SpeechRecognitionEngine 对象的 |
| RecognitionEventArgs |
提供有关语音识别事件的信息。Provides information about speech recognition events. |
| RecognitionResult |
包含有关由 SpeechRecognitionEngine 或 SpeechRecognizer 实例识别的输入的详细信息。Contains detailed information about input that was recognized by instances of SpeechRecognitionEngine or SpeechRecognizer. |
| RecognizeCompletedEventArgs |
为由 SpeechRecognitionEngine 或 SpeechRecognizer 对象引发的 |
| RecognizedAudio |
表示与 RecognitionResult 关联的音频输入。Represents audio input that is associated with a RecognitionResult. |
| RecognizedPhrase |
包含由语音识别器生成的有关识别的输入的详细信息。Contains detailed information, generated by the speech recognizer, about the recognized input. |
| RecognizedWordUnit |
提供可识别的语音的原子单元。Provides the atomic unit of recognized speech. |
| RecognizerInfo |
表示有关 SpeechRecognizer 或 SpeechRecognitionEngine 接口的信息。Represents information about a SpeechRecognizer or SpeechRecognitionEngine instance. |
| RecognizerUpdateReachedEventArgs |
从 RecognizerUpdateReached 或 RecognizerUpdateReached 事件返回数据。Returns data from a RecognizerUpdateReached or a RecognizerUpdateReached event. |
| ReplacementText |
包含有关在识别结果中执行的语音规范化程序的信息。Contains information about a speech normalization procedure that has been performed on recognition results. |
| SemanticResultKey |
将密匙字符串与 SemanticResultValue 值关联,以定义 SemanticValue 对象。Associates a key string with SemanticResultValue values to define SemanticValue objects. |
| SemanticResultValue |
表示一个语义值和选择性地将该值与语音识别语法的组件关联。Represents a semantic value and optionally associates the value with a component of a speech recognition grammar. |
| SemanticValue |
表示已识别的短语的语义组织。Represents the semantic organization of a recognized phrase. |
| SpeechDetectedEventArgs |
从 SpeechDetected 或 SpeechDetected 事件返回数据。Returns data from SpeechDetected or SpeechDetected events. |
| SpeechHypothesizedEventArgs |
从 SpeechHypothesized 或 SpeechHypothesized 事件返回通知。Returns notification from SpeechHypothesized or SpeechHypothesized events. 此类支持 .NET Framework 基础结构,但不应在应用程序代码中直接使用。This class supports the .NET Framework infrastructure and is not intended to be used directly from application code. |
| SpeechRecognitionEngine |
提供访问和管理进程内语音识别引擎。Provides the means to access and manage an in-process speech recognition engine. |
| SpeechRecognitionRejectedEventArgs |
提供有关 SpeechRecognitionRejected 和 SpeechRecognitionRejected 事件的信息。Provides information for the SpeechRecognitionRejected and SpeechRecognitionRejected events. |
| SpeechRecognizedEventArgs |
为 SpeechRecognized、SpeechRecognized 和 SpeechRecognized 事件提供信息。Provides information for the SpeechRecognized, SpeechRecognized, and SpeechRecognized events. |
| SpeechRecognizer |
提供对在 Windows 桌面上可用的共享语言识别服务的访问。Provides access to the shared speech recognition service available on the Windows desktop. |
| SpeechUI |
在语音平台用户界面中显示的标识操作提供文本和状态信息。Provides text and status information on recognition operations to be displayed in the Speech platform user interface. |
| StateChangedEventArgs |
从 StateChanged 事件返回数据。Returns data from the StateChanged event. |
枚举
| AudioSignalProblem |
在转到语音识别引擎的音频信号中包含可能问题列表。Contains a list of possible problems in the audio signal coming in to a speech recognition engine. |
| AudioState |
音频输入到语音识别引擎包含可能状态列表。Contains a list of possible states for the audio input to a speech recognition engine. |
| DisplayAttributes |
列出 SpeechRecognitionEngine 可用于为显示单词或标点符号指定空白的选项。Lists the options that the SpeechRecognitionEngine object can use to specify white space for the display of a word or punctuation mark. |
| RecognizeMode |
枚举识别模式的值。Enumerates values of the recognition mode. |
| RecognizerState |
枚举识别器状态的值。Enumerates values of the recognizer's state. |
| SubsetMatchingMode |
枚举匹配模式的子集值。Enumerates values of subset matching mode. |
注解
Windows 桌面语音技术软件提供了一个基本的语音识别基础结构,它 digitizes acoustical 的信号,并从音频输入中恢复字词和语音元素。The Windows Desktop Speech Technology software offers a basic speech recognition infrastructure that digitizes acoustical signals, and recovers words and speech elements from audio input.
应用程序 System.Speech.Recognition 通过定义用于识别特定短语或 word 模式的算法,以及通过管理此语音基础结构的运行时行为,使用命名空间访问和扩展此基本语音识别技术。Applications use the System.Speech.Recognition namespace to access and extend this basic speech recognition technology by defining algorithms for identifying and acting on specific phrases or word patterns, and by managing the runtime behavior of this speech infrastructure.
创建语法Create Grammars
你可以创建由一组规则或约束组成的语法,用于定义你的应用程序将识别为有意义的输入的单词和短语。You create grammars, which consist of a set of rules or constraints, to define words and phrases that your application will recognize as meaningful input. 使用类的构造函数 Grammar ,可以在运行时从或实例创建语法对象 GrammarBuilder SrgsDocument ,也可以从文件、字符串或包含语法定义的流创建语法对象。Using a constructor for the Grammar class, you can create a grammar object at runtime from GrammarBuilder or SrgsDocument instances, or from a file, a string, or a stream that contains a definition of a grammar.
使用 GrammarBuilder 和 Choices 类,您可以以编程方式创建低到中等复杂性的语法,这种语法可用于对许多常见方案执行识别。Using the GrammarBuilder and Choices classes, you can programmatically create grammars of low to medium complexity that can be used to perform recognition for many common scenarios. 若要以编程方式创建符合 语音识别语法规范 1.0 (srgs 的语法) 并利用 srgs 的创作灵活性,请使用 System.Speech.Recognition.SrgsGrammar 命名空间的类型。To create grammars programmatically that conform to the Speech Recognition Grammar Specification 1.0 (SRGS) and take advantage of the authoring flexibility of SRGS, use the types of the System.Speech.Recognition.SrgsGrammar namespace. 你还可以使用任何文本编辑器创建 XML 格式的 SRGS 语法,并使用该结果创建 GrammarBuilder 、 SrgsDocument 或 Grammar 对象。You can also create XML-format SRGS grammars using any text editor and use the result to create GrammarBuilder, SrgsDocument , or Grammar objects.
此外, DictationGrammar 类还提供了一种特殊的语法来支持传统听写模型。In addition, the DictationGrammar class provides a special-case grammar to support a conventional dictation model.
有关详细信息和示例,请参阅在系统语音编程指南中创建语法.NET Framework。See Create Grammars in the System Speech Programming Guide for .NET Framework for more information and examples.
管理语音识别引擎Manage Speech Recognition Engines
使用对象提供的实例 SpeechRecognizer SpeechRecognitionEngine Grammar 提供对 Windows 桌面语音技术的语音识别引擎的主要访问。Instances of SpeechRecognizer and SpeechRecognitionEngine supplied with Grammar objects provide the primary access to the speech recognition engines of the Windows Desktop Speech Technology.
你可以使用 SpeechRecognizer 类来创建客户端应用程序,这些应用程序使用 Windows 提供的语音识别技术,你可以通过 " 控制面板 " 进行配置。You can use the SpeechRecognizer class to create client applications that use the speech recognition technology provided by Windows, which you can configure through the Control Panel . 此类应用程序通过计算机的默认音频输入机制接受输入。Such applications accept input through a computer's default audio input mechanism.
为了更好地控制识别引擎的配置和类型,请使用 SpeechRecognitionEngine 在进程内运行的来生成应用程序。For more control over the configuration and type of recognition engine, build an application using SpeechRecognitionEngine, which runs in-process. 使用 SpeechRecognitionEngine 类,还可以动态选择设备、文件或流中的音频输入。Using the SpeechRecognitionEngine class, you can also dynamically select audio input from devices, files, or streams.
有关详细信息,请参阅.NET Framework 系统语音编程指南中的初始化和管理语音识别引擎。See Initialize and Manage a Speech Recognition Engine in the System Speech Programming Guide for .NET Framework for more information.
响应事件Respond to Events
SpeechRecognizer 和 SpeechRecognitionEngine 对象生成事件以响应语音识别引擎的音频输入。SpeechRecognizer and SpeechRecognitionEngine objects generate events in response to audio input to the speech recognition engine. AudioLevelUpdated AudioSignalProblemOccurred AudioStateChanged 为响应传入信号中的更改而引发的事件。The AudioLevelUpdated, AudioSignalProblemOccurred, AudioStateChanged events are raised in response to changes in the incoming signal. SpeechDetected语音识别引擎将传入音频标识为语音时,会引发事件。The SpeechDetected event is raised when the speech recognition engine identifies incoming audio as speech. 当语音识别引擎将 SpeechRecognized 语音输入与它的加载语法之一进行匹配时,它将引发事件,并在 SpeechRecognitionRejected 语音输入与加载的任何语法不匹配时引发。The speech recognition engine raises the SpeechRecognized event when it matches speech input to one of its loaded grammars, and raises the SpeechRecognitionRejected when speech input does not match any of its loaded grammars.
其他类型的事件包括 LoadGrammarCompleted 语音识别引擎加载语法时引发的事件。Other types of events include the LoadGrammarCompleted event which a speech recognition engine raises when it has loaded a grammar. 对 StateChanged 类是独占的 SpeechRecognizer ,它在 Windows 语音识别的状态发生更改时引发事件。The StateChanged is exclusive to the SpeechRecognizer class, which raises the event when the state of Windows Speech Recognition changes.
你可以注册以接收语音识别引擎引发的事件的通知,并使用 EventsArgs 与每个事件关联的类创建处理程序,以便在引发事件时对应用程序的行为进行编程。You can register to be notified for events that the speech recognition engine raises and create handlers using the EventsArgs classes associated with each of these events to program your application's behavior when an event is raised.
有关详细信息,请参阅在系统语音编程指南中使用语音识别事件.NET Framework。See Using Speech Recognition Events in the System Speech Programming Guide for .NET Framework for more information.