System.Speech.Recognition 命名空間

System.Speech.Recognition 命名空間包含可用於實作語音辨識的 Windows Desktop Speech 技術型別。 The System.Speech.Recognition namespace contains Windows Desktop Speech technology types for implementing speech recognition.



提供 SpeechRecognizerSpeechRecognitionEngine 類別的 AudioLevelUpdated 事件資料。Provides data for the AudioLevelUpdated event of the SpeechRecognizer or the SpeechRecognitionEngine class.


提供 SpeechRecognizerSpeechRecognitionEngineAudioSignalProblemOccurred 事件的資料。Provides data for the AudioSignalProblemOccurred event of a SpeechRecognizer or a SpeechRecognitionEngine.


提供 SpeechRecognizerSpeechRecognitionEngine 類別的 AudioStateChanged 事件資料。Provides data for the AudioStateChanged event of the SpeechRecognizer or the SpeechRecognitionEngine class.


表示語音辨識文法條件約束中的一組替代項。Represents a set of alternatives in the constraints of a speech recognition grammar.


表示語音辨識文法,用來進行自由文字聽寫。Represents a speech recognition grammar used for free text dictation.


提供 SpeechRecognizerSpeechRecognitionEngine 類別的 EmulateRecognizeCompleted 事件資料。Provides data for the EmulateRecognizeCompleted event of the SpeechRecognizer and SpeechRecognitionEngine classes.


A runtime object that references a speech recognition grammar, which an application can use to define the constraints for speech recognition.A runtime object that references a speech recognition grammar, which an application can use to define the constraints for speech recognition.


Provides a mechanism for programmatically building the constraints for a speech recognition grammar.Provides a mechanism for programmatically building the constraints for a speech recognition grammar.


提供 SpeechRecognizerSpeechRecognitionEngine 物件的 LoadGrammarCompleted 事件資料。Provides data for the LoadGrammarCompleted event of a SpeechRecognizer or SpeechRecognitionEngine object.


提供有關語音辨識事件的資訊。Provides information about speech recognition events.


包含SpeechRecognitionEngineSpeechRecognizer的執行個體所辨認的輸入的詳細資訊。Contains detailed information about input that was recognized by instances of SpeechRecognitionEngine or SpeechRecognizer.


提供 SpeechRecognitionEngineSpeechRecognizer 物件引發之 RecognizeCompleted 事件的資料。Provides data for the RecognizeCompleted event raised by a SpeechRecognitionEngine or a SpeechRecognizer object.


表示與 RecognitionResult 相關聯的音訊輸入。Represents audio input that is associated with a RecognitionResult.


包含語音辨識器所產生的有關已辨識輸入的詳細資訊。Contains detailed information, generated by the speech recognizer, about the recognized input.


提供辨識語音的不可部分完成的單位。Provides the atomic unit of recognized speech.


表示 SpeechRecognizerSpeechRecognitionEngine 執行個體的相關資訊。Represents information about a SpeechRecognizer or SpeechRecognitionEngine instance.


RecognizerUpdateReachedRecognizerUpdateReached 事件傳回資料。Returns data from a RecognizerUpdateReached or a RecognizerUpdateReached event.


包含在辨識結果上執行的語音正規化程序的相關資訊。Contains information about a speech normalization procedure that has been performed on recognition results.


將索引鍵字串與SemanticResultValue值關聯在一起,以定義SemanticValue物件。Associates a key string with SemanticResultValue values to define SemanticValue objects.


代表語意值,並選擇性地將值與語音辨識文法的元件相關聯。Represents a semantic value and optionally associates the value with a component of a speech recognition grammar.


表示已辨識片語的語意組織。Represents the semantic organization of a recognized phrase.


SpeechDetectedSpeechDetected 事件傳回資料。Returns data from SpeechDetected or SpeechDetected events.


SpeechHypothesizedSpeechHypothesized 事件傳回通知。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.


提供方法來存取和管理處理中的語音辨識引擎。Provides the means to access and manage an in-process speech recognition engine.


提供 SpeechRecognitionRejectedSpeechRecognitionRejected 事件的資訊。Provides information for the SpeechRecognitionRejected and SpeechRecognitionRejected events.


提供 SpeechRecognizedSpeechRecognized,以及 SpeechRecognized 事件的資訊。Provides information for the SpeechRecognized, SpeechRecognized, and SpeechRecognized events.


為 Windows 桌面上共用的語音辨識服務提供存取。Provides access to the shared speech recognition service available on the Windows desktop.


提供要在語音平台使用者介面中顯示的辨識作業文字和狀態資訊。Provides text and status information on recognition operations to be displayed in the Speech platform user interface.


StateChanged 事件傳回資料。Returns data from the StateChanged event.



包含傳入至語音辨識引擎的音訊訊號中可能發生的問題的清單。Contains a list of possible problems in the audio signal coming in to a speech recognition engine.


包含傳入至語音辨識引擎的音訊輸入的可能狀態的清單。Contains a list of possible states for the audio input to a speech recognition engine.


列出選項,SpeechRecognitionEngine 物件可用來指定空白區以顯示某個字或標點符號。Lists the options that the SpeechRecognitionEngine object can use to specify white space for the display of a word or punctuation mark.


列舉辨識模式的值。Enumerates values of the recognition mode.


列舉辨識器狀態的值。Enumerates values of the recognizer's state.


列舉子集比對模式的值。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命名空間來存取及擴充此基本的語音辨識技術,藉由定義的演算法來識別,並根據特定的片語或單字模式,並藉由管理這個語音的執行階段行為基礎結構。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類別,您可以在執行階段從建立的文法物件GrammarBuilderSrgsDocument執行個體,或從檔案、 字串或包含文法定義的資料流。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.

使用GrammarBuilderChoices類別,您可以透過程式設計方式建立的低到中等複雜度,可用來執行許多一般案例的辨識文法。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 文法使用任何文字編輯器,並使用結果來建立GrammarBuilderSrgsDocument ,或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

執行個體SpeechRecognizerSpeechRecognitionEngine隨附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

SpeechRecognizerSpeechRecognitionEngine物件產生的事件以回應至語音辨識引擎的音訊輸入。SpeechRecognizer and SpeechRecognitionEngine objects generate events in response to audio input to the speech recognition engine. AudioLevelUpdatedAudioSignalProblemOccurredAudioStateChanged事件會引發以回應傳入的訊號中的變更。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是專為SpeechRecognizerWindows 語音辨識的狀態變更時,引發事件的類別。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.