通过


IntentRecognizerSet class

跨一组意向识别器联合 recognize() 调用。

扩展

构造函数

IntentRecognizerSet(IIntentRecognizerSetOptions)

构造 IntentRecognizerSet 的新实例。

属性

length

集中的识别器数。

方法

clone(IntentRecognizerSet)

返回现有 IntentRecognizerSet 的克隆。

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

注册函数以有条件地启用/禁用识别器。 可以注册多个处理程序,并在任何其他处理程序之前执行新处理程序。

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

注册函数以筛选识别器的输出。 可以注册多个处理程序,并在任何其他处理程序之后执行新处理程序。

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

实现实际的识别逻辑。

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

尝试将用户文本话语与意向匹配。

recognizer(IIntentRecognizer)

将新的识别器插件添加到集。

构造函数详细信息

IntentRecognizerSet(IIntentRecognizerSetOptions)

构造 IntentRecognizerSet 的新实例。

new IntentRecognizerSet(options?: IIntentRecognizerSetOptions)

参数

options
IIntentRecognizerSetOptions

(可选)用于初始化集和控制识别流的选项。

属性详细信息

length

集中的识别器数。

length: number

属性值

number

方法详细信息

clone(IntentRecognizerSet)

返回现有 IntentRecognizerSet 的克隆。

function clone(copyTo?: IntentRecognizerSet)

参数

copyTo
IntentRecognizerSet

(可选)要将当前对象复制到的实例。 如果缺少新实例,则会创建。

返回

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

注册函数以有条件地启用/禁用识别器。 可以注册多个处理程序,并在任何其他处理程序之前执行新处理程序。

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

参数

handler

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

为每个消息调用的函数。 应为每个应识别的消息调用 callback(null, true)

返回

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

注册函数以筛选识别器的输出。 可以注册多个处理程序,并在任何其他处理程序之后执行新处理程序。

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

参数

handler

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

针对导致分数大于 0.0 的意向的每个消息调用的函数。 应调用 callback(null, { score: 0.0, intent: null }) 来阻止返回意向。

返回

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

实现实际的识别逻辑。

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

参数

callback

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

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

尝试将用户文本话语与意向匹配。

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

参数

context
IRecognizeContext

正在识别的已接收消息的上下文信息。

callback

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

使用识别操作结果调用的函数。

recognizer(IIntentRecognizer)

将新的识别器插件添加到集。

function recognizer(plugin: IIntentRecognizer)

参数

plugin
IIntentRecognizer

要添加的识别器。

返回