IntentRecognizer class

Intent recognizer.

Extends

Constructors

IntentRecognizer(SpeechConfig, AudioConfig)

Initializes an instance of the IntentRecognizer.

Properties

authorizationToken

Gets the authorization token used to communicate with the service.

canceled

The event canceled signals that an error occurred during recognition.

internalData
properties

The collection of properties and their values defined for this IntentRecognizer.

recognized

The event recognized signals that a final recognition result is received.

recognizing

The event recognizing signals that an intermediate recognition result is received.

speechRecognitionLanguage

Gets the spoken language of recognition.

telemetryEnabled

This method returns the current state of the telemetry setting.

Inherited Properties

sessionStarted

Defines event handler for session started events.

sessionStopped

Defines event handler for session stopped events.

speechEndDetected

Defines event handler for speech stopped events.

speechStartDetected

Defines event handler for speech started events.

Methods

addAllIntents(LanguageUnderstandingModel, string)
addIntent(string, string)

Adds a phrase that should be recognized as intent.

addIntentWithLanguageModel(string, LanguageUnderstandingModel, string)

Adds an intent from Language Understanding service for recognition.

close(() => void, (error: string) => void)

closes all external resources held by an instance of this class.

recognizeOnceAsync((e: IntentRecognitionResult) => void, (e: string) => void)

Starts intent recognition, and stops after the first utterance is recognized. The task returns the recognition text and intent as result. Note: RecognizeOnceAsync() returns when the first utterance has been recognized, so it is suitable only for single shot recognition like command or query. For long-running recognition, use StartContinuousRecognitionAsync() instead.

startContinuousRecognitionAsync(() => void, (e: string) => void)

Starts speech recognition, until stopContinuousRecognitionAsync() is called. User must subscribe to events to receive recognition results.

startKeywordRecognitionAsync(KeywordRecognitionModel, () => void, (e: string) => void)

Starts speech recognition with keyword spotting, until stopKeywordRecognitionAsync() is called. User must subscribe to events to receive recognition results. Note: Key word spotting functionality is only available on the Speech Devices SDK. This functionality is currently not included in the SDK itself.

stopContinuousRecognitionAsync(() => void, (e: string) => void)

Stops continuous intent recognition.

stopKeywordRecognitionAsync(() => void, (e: string) => void)

Stops continuous speech recognition. Note: Key word spotting functionality is only available on the Speech Devices SDK. This functionality is currently not included in the SDK itself.

Inherited Methods

enableTelemetry(boolean)

This method globally enables or disables telemetry.

Constructor Details

IntentRecognizer(SpeechConfig, AudioConfig)

Initializes an instance of the IntentRecognizer.

new IntentRecognizer(speechConfig: SpeechConfig, audioConfig?: AudioConfig)

Parameters

speechConfig
SpeechConfig

The set of configuration properties.

audioConfig
AudioConfig

An optional audio input config associated with the recognizer

Property Details

authorizationToken

Gets the authorization token used to communicate with the service.

string authorizationToken

Property Value

string

Authorization token.

canceled

The event canceled signals that an error occurred during recognition.

public canceled: (sender: IntentRecognizer, event: IntentRecognitionCanceledEventArgs) => void

Property Value

(sender: IntentRecognizer, event: IntentRecognitionCanceledEventArgs) => void

internalData

object internalData

Property Value

object

properties

The collection of properties and their values defined for this IntentRecognizer.

PropertyCollection properties

Property Value

The collection of properties and their values defined for this IntentRecognizer.

recognized

The event recognized signals that a final recognition result is received.

public recognized: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void

Property Value

(sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void

recognizing

The event recognizing signals that an intermediate recognition result is received.

public recognizing: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void

Property Value

(sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void

speechRecognitionLanguage

Gets the spoken language of recognition.

string speechRecognitionLanguage

Property Value

string

the spoken language of recognition.

telemetryEnabled

This method returns the current state of the telemetry setting.

static boolean telemetryEnabled

Property Value

boolean

true if the telemetry is enabled, false otherwise.

Inherited Property Details

sessionStarted

Defines event handler for session started events.

public sessionStarted: (sender: Recognizer, event: SessionEventArgs) => void

Property Value

(sender: Recognizer, event: SessionEventArgs) => void

Inherited From Recognizer.sessionStarted

sessionStopped

Defines event handler for session stopped events.

public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void

Property Value

(sender: Recognizer, event: SessionEventArgs) => void

Inherited From Recognizer.sessionStopped

speechEndDetected

Defines event handler for speech stopped events.

public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void

Property Value

(sender: Recognizer, event: RecognitionEventArgs) => void

Inherited From Recognizer.speechEndDetected

speechStartDetected

Defines event handler for speech started events.

public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void

Property Value

(sender: Recognizer, event: RecognitionEventArgs) => void

Inherited From Recognizer.speechStartDetected

Method Details

addAllIntents(LanguageUnderstandingModel, string)

function addAllIntents(model: LanguageUnderstandingModel, intentId?: string)

Parameters

model
LanguageUnderstandingModel

The language understanding model containing the intents.

intentId

string

A custom id String to be returned in the IntentRecognitionResult's getIntentId() method.

addIntent(string, string)

Adds a phrase that should be recognized as intent.

function addIntent(simplePhrase: string, intentId?: string)

Parameters

simplePhrase

string

intentId

string

A String that represents the identifier of the intent to be recognized.

addIntentWithLanguageModel(string, LanguageUnderstandingModel, string)

Adds an intent from Language Understanding service for recognition.

function addIntentWithLanguageModel(intentId: string, model: LanguageUnderstandingModel, intentName?: string)

Parameters

intentId

string

A String that represents the identifier of the intent to be recognized. Ignored if intentName is empty.

model
LanguageUnderstandingModel

The intent model from Language Understanding service.

intentName

string

The intent name defined in the intent model. If it is empty, all intent names defined in the model will be added.

close(() => void, (error: string) => void)

closes all external resources held by an instance of this class.

function close(cb?: () => void, errorCb?: (error: string) => void)

Parameters

cb

() => void

errorCb

(error: string) => void

recognizeOnceAsync((e: IntentRecognitionResult) => void, (e: string) => void)

Starts intent recognition, and stops after the first utterance is recognized. The task returns the recognition text and intent as result. Note: RecognizeOnceAsync() returns when the first utterance has been recognized, so it is suitable only for single shot recognition like command or query. For long-running recognition, use StartContinuousRecognitionAsync() instead.

function recognizeOnceAsync(cb?: (e: IntentRecognitionResult) => void, err?: (e: string) => void)

Parameters

cb

(e: IntentRecognitionResult) => void

Callback that received the recognition has finished with an IntentRecognitionResult.

err

(e: string) => void

Callback invoked in case of an error.

startContinuousRecognitionAsync(() => void, (e: string) => void)

Starts speech recognition, until stopContinuousRecognitionAsync() is called. User must subscribe to events to receive recognition results.

function startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void)

Parameters

cb

() => void

Callback invoked once the recognition has started.

err

(e: string) => void

Callback invoked in case of an error.

startKeywordRecognitionAsync(KeywordRecognitionModel, () => void, (e: string) => void)

Starts speech recognition with keyword spotting, until stopKeywordRecognitionAsync() is called. User must subscribe to events to receive recognition results. Note: Key word spotting functionality is only available on the Speech Devices SDK. This functionality is currently not included in the SDK itself.

function startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void)

Parameters

model
KeywordRecognitionModel

The keyword recognition model that specifies the keyword to be recognized.

cb

() => void

Callback invoked once the recognition has started.

err

(e: string) => void

Callback invoked in case of an error.

stopContinuousRecognitionAsync(() => void, (e: string) => void)

Stops continuous intent recognition.

function stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void)

Parameters

cb

() => void

Callback invoked once the recognition has stopped.

err

(e: string) => void

Callback invoked in case of an error.

stopKeywordRecognitionAsync(() => void, (e: string) => void)

Stops continuous speech recognition. Note: Key word spotting functionality is only available on the Speech Devices SDK. This functionality is currently not included in the SDK itself.

function stopKeywordRecognitionAsync(cb?: () => void, err?: (e: string) => void)

Parameters

cb

() => void

Callback invoked once the recognition has stopped.

err

(e: string) => void

Callback invoked in case of an error.

Inherited Method Details

enableTelemetry(boolean)

This method globally enables or disables telemetry.

static function enableTelemetry(enabled: boolean)

Parameters

enabled

boolean

Global setting for telemetry collection. If set to true, telemetry information like microphone errors, recognition errors are collected and sent to Microsoft. If set to false, no telemetry is sent to Microsoft.

Inherited From Recognizer.enableTelemetry