Class: Nlu

Nlu(intents)

封装DuerOS 对query的解析结果 只有IntentRequest 才有Nlu结构

Constructor

new Nlu(intents)

构造函数
Parameters:
Name Type Description
intents array IntentRequest 中的intents
Source:

Members

_directive

记录返回的指令
Source:

Methods

ask(slot) → {null}

Bot主动发起对一个槽位的询问。比如:打车时询问用户目的地
Parameters:
Name Type Description
slot string 槽位名
Source:
Returns:
Type
null
Example
this.ask('destination');

getIntentConfirmationStatus()

获取一个intent对应的confirmationStatus
Source:
Returns:
{string 意图的confirmationStatus

getIntentName() → {string|null}

获取DuerOS请求中的意图名
Source:
Returns:
Type
string | null

getSlot(field, index) → {null|string}

通过槽位名获取一个槽位的值
Parameters:
Name Type Default Description
field string 槽位名
index Integer 0 第几个intent,默认第一个
Source:
Returns:
Type
null | string

getSlotConfirmationStatus(field) → {string}

获取一个slot对应的confirmationStatus
Parameters:
Name Type Description
field string 槽位名
Source:
Returns:
槽位的confirmationStatus
Type
string

hasAsked() → {Boolean}

Bot是否在询问用户,等待用户的回复
Source:
Returns:
Type
Boolean

setConfirmIntent()

主动发起对一个意图的确认,此时还需同时返回询问的outputSpeach。 主动发起的确认,DM不会使用默认配置的话术。 一般当槽位填槽完毕,在进行下一步操作之前,一次性的询问各个槽位,是否符合用户预期。
Source:
Example
this.setConfirmIntent();

setConfirmSlot(field)

主动发起对一个槽位的确认,此时还需同时返回询问的outputSpeach。 主动发起的确认,DM不会使用默认配置的话术。
Parameters:
Name Type Description
field string 槽位名
Source:
Example
this.setConfirmSlot('destination');

setDelegate()

设置将对话的处理代理给Dialog Management(DM)。 按事先配置的顺序,包括对缺失槽位的询问,槽位值的确认(如果设置了槽位需要确认,以及确认的话术) 和整个意图的确认(如果设置了意图需要确认,以及确认的话术。比如可以将收集的槽位依次列出,等待用户确认)
Source:

setSlot(field, value, index)

通过槽位名设置一个槽位的值,如果没有此槽位,新增一个
Parameters:
Name Type Default Description
field string 槽位名
value string
index Integer 0 第几个intent,默认第一个
Source:

toDirective() → {array}

Source:
Returns:
Type
array

toUpdateIntent() → {Object}

Source:
Returns:
Type
Object