IntentRecognizerSet class

Federates a recognize() call across a set of intent recognizers.

Extends

Constructors

IntentRecognizerSet(IIntentRecognizerSetOptions)

Constructs a new instance of an IntentRecognizerSet.

Properties

length

Number of recognizers in the set.

Methods

clone(IntentRecognizerSet)

Returns a clone of an existing IntentRecognizerSet.

onEnabled((context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)

Registers a function to conditionally enable/disable the recognizer. Multiple handlers can be registered and the new handler will be executed before any other handlers.

onFilter((context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)

Registers a function to filter the output from the recognizer. Multiple handlers can be registered and the new handler will be executed after any other handlers.

onRecognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)

Implements the actual recognition logic.

recognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)

Attempts to match a users text utterance to an intent.

recognizer(IIntentRecognizer)

Adds a new recognizer plugin to the set.

Constructor Details

IntentRecognizerSet(IIntentRecognizerSetOptions)

Constructs a new instance of an IntentRecognizerSet.

new IntentRecognizerSet(options?: IIntentRecognizerSetOptions)

Parameters

options
IIntentRecognizerSetOptions

(Optional) options used to initialize the set and control the flow of recognition.

Property Details

length

Number of recognizers in the set.

length: number

Property Value

number

Method Details

clone(IntentRecognizerSet)

Returns a clone of an existing IntentRecognizerSet.

function clone(copyTo?: IntentRecognizerSet)

Parameters

copyTo
IntentRecognizerSet

(Optional) instance to copy the current object to. If missing a new instance will be created.

Returns

onEnabled((context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)

Registers a function to conditionally enable/disable the recognizer. Multiple handlers can be registered and the new handler will be executed before any other handlers.

function onEnabled(handler: (context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)

Parameters

handler

(context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void

Function called for every message. You should call callback(null, true) for every message that should be recognized.

Returns

onFilter((context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)

Registers a function to filter the output from the recognizer. Multiple handlers can be registered and the new handler will be executed after any other handlers.

function onFilter(handler: (context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)

Parameters

handler

(context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void

Function called for every message that results in an intent with a score greater then 0.0. You should call callback(null, { score: 0.0, intent: null }) to block an intent from being returned.

Returns

onRecognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)

Implements the actual recognition logic.

function onRecognize(context: IRecognizeContext, callback: (err: Error, result: IIntentRecognizerResult) => void)

Parameters

callback

(err: Error, result: IIntentRecognizerResult) => void

recognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)

Attempts to match a users text utterance to an intent.

function recognize(context: IRecognizeContext, callback: (err: Error, result: IIntentRecognizerResult) => void)

Parameters

context
IRecognizeContext

Contextual information for a received message that's being recognized.

callback

(err: Error, result: IIntentRecognizerResult) => void

Function to invoke with the results of the recognition operation.

recognizer(IIntentRecognizer)

Adds a new recognizer plugin to the set.

function recognizer(plugin: IIntentRecognizer)

Parameters

plugin
IIntentRecognizer

The recognizer to add.

Returns