IntentRecognizer Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Recognizes intents using a language understanding (LUIS) model or phrase.
public sealed class IntentRecognizer : Microsoft.CognitiveServices.Speech.Recognizer
type IntentRecognizer = class
inherit Recognizer
Public NotInheritable Class IntentRecognizer
Inherits Recognizer
- Inheritance
Remarks
Intents indicate what the user wishes to initiate or do based on options you define. Successful intent recognition returns both recognized text and recognized intent.
See also: Get started with intent recognition
Constructors
IntentRecognizer(EmbeddedSpeechConfig) |
Creates a new instance of IntentRecognizer using EmbeddedSpeechConfig, configured to receive speech from the default microphone. Added in 1.20.0 |
IntentRecognizer(EmbeddedSpeechConfig, AudioConfig) |
Creates a new instance of IntentRecognizer using EmbeddedSpeechConfig, configured to receive speech from an audio source specified in an AudioConfig object. Added in 1.20.0 |
IntentRecognizer(SpeechConfig) |
Creates a new instance of IntentRecognizer. |
IntentRecognizer(SpeechConfig, AudioConfig) |
Creates a new instance of IntentRecognizer. |
Fields
disposed |
disposed is a flag used to indicate if object is disposed. (Inherited from Recognizer) |
gch |
GC handle for callbacks for context. (Inherited from Recognizer) |
isDisposing |
Indicates whether the object is currently being disposed. (Inherited from Recognizer) |
pointerHandle |
Internal for logging. (Inherited from Recognizer) |
recognizerLock |
recognizerLock is used to synchronize access to objects member variables from multiple threads (Inherited from Recognizer) |
Properties
AuthorizationToken |
Gets or sets authorization token used to communicate with the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the recognizer will encounter errors during recognition. |
Properties |
Gets the collection of properties and their values defined for this IntentRecognizer. |
SpeechRecognitionLanguage |
Gets the language name that is used for recognition. |
Methods
AddAllIntents(LanguageUnderstandingModel) |
Adds all intents from the specified Language Understanding Model. For PatternMatchingModel and ConversationalLanguageUnderstandingModel types, this will clear any existing models before enabling it. |
AddAllIntents(LanguageUnderstandingModel, String) |
Adds a single intent by name from the specified Language Understanding Model. For PatternMatchingModel and ConversationalLanguageUnderstandingModel types, this will clear any existing models before enabling it. For these types, the intentName is ignored. |
AddIntent(LanguageUnderstandingModel, String) |
Adds a single intent by name from the specified Language Understanding Model. For PatternMatchingModel and ConversationalLanguageUnderstandingModel types, this will clear any existing models before enabling it. For these types, the intentName is ignored. |
AddIntent(LanguageUnderstandingModel, String, String) |
Adds a single intent by name from the specified Language Understanding Model. For PatternMatchingModel and ConversationalLanguageUnderstandingModel types, this will clear any existing models before enabling it. For these types, the intentName and intentId are ignored. |
AddIntent(String) |
Adds a simple phrase that may be spoken by the user, indicating a specific user intent. |
AddIntent(String, String) |
Adds a simple phrase that may be spoken by the user, indicating a specific user intent. |
ApplyLanguageModels(LanguageUnderstandingModelCollection) |
Takes a collection of language understanding models, makes a copy of them, and applies them to the recognizer. This application takes effect at different times depending on the LanguageUnderstandingModel type. PatternMatchingModels will become active immediately whereas LanguageUnderstandingModels utilizing the LUIS service will become active immediately unless the recognizer is in the middle of intent recognition in which case it will take effect after the next Recognized event. |
Dispose() |
Dispose of associated resources. (Inherited from Recognizer) |
Dispose(Boolean) |
This method performs cleanup of resources.
The Boolean parameter |
Finalize() | |
RecognizeOnceAsync() |
Starts speech recognition with intent recognition as an asynchronous operation. |
RecognizeOnceAsync(String) |
Performs intent recognition, and generates a result from the text passed in. This is useful for testing and other times when the speech input is not tied to the IntentRecognizer. Note: The Intent Service does not currently support this so it is only valid for offline pattern matching or exact matching intents. |
StartContinuousRecognitionAsync() |
Starts speech recognition on a continuous audio stream asynchronously, until StopContinuousRecognitionAsync() is called. |
StartKeywordRecognitionAsync(KeywordRecognitionModel) |
Configures the recognizer with the given keyword model. After calling this method, the recognizer is listening for the keyword to start the recognition. Call StopKeywordRecognitionAsync() to end the keyword initiated recognition. You must subscribe to events to receive recognition results. |
StopContinuousRecognitionAsync() |
Stops a running recognition operation as soon as possible and immediately requests a result based on the the input that has been processed so far. This works for all recognition operations, not just continuous ones, and facilitates the use of push-to-talk or "finish now" buttons for manual audio endpointing. |
StopKeywordRecognitionAsync() |
Ends the keyword initiated recognition. |
Events
Canceled |
The event Canceled signals that the intent recognition was canceled. |
Recognized |
The event Recognized signals that a final recognition result is received. |
Recognizing |
The event Recognizing signals that an intermediate recognition result is received. |
SessionStarted |
Defines event handler for session started event. (Inherited from Recognizer) |
SessionStopped |
Defines event handler for session stopped event. (Inherited from Recognizer) |
SpeechEndDetected |
Defines event handler for speech end detected event. (Inherited from Recognizer) |
SpeechStartDetected |
Defines event handler for speech start detected event. (Inherited from Recognizer) |
Applies to
Azure SDK for .NET