Skip to content

Latest commit

 

History

History
189 lines (137 loc) · 6.02 KB

Nlu.md

File metadata and controls

189 lines (137 loc) · 6.02 KB

Nlu

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

Kind: global class

new Nlu(intents)

构造函数

Param Type Description
intents Object IntentRequest 中的intents

nlu._directive

记录返回的指令

Kind: instance property of Nlu

nlu.setSlot(field, value, index)

通过槽位名设置一个槽位的值,如果没有此槽位,新增一个

Kind: instance method of Nlu
Access: public

Param Type Default Description
field string 槽位名
value string
index Integer 0 第几个intent,默认第一个

nlu.getSlot(field, index) ⇒ null | string

通过槽位名获取一个槽位的值

Kind: instance method of Nlu
Access: public

Param Type Default Description
field string 槽位名
index number 0 第几个intent,默认第一个

nlu.getIntentName() ⇒ string | null

获取DuerOS请求中的意图名

Kind: instance method of Nlu
Access: public

nlu.hasAsked() ⇒ boolean

Bot是否在询问用户,等待用户的回复

Kind: instance method of Nlu

nlu.ask(slot)

Bot主动发起对一个槽位的询问。比如:打车时询问用户目的地

Kind: instance method of Nlu
Access: public

Param Type Description
slot string 槽位名

Example

this.ask('destination');

nlu.toDirective() ⇒ Object

获取 _directive

Kind: instance method of Nlu

nlu.toUpdateIntent() ⇒ Object

toUpdateIntent

Kind: instance method of Nlu

nlu.setDelegate()

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

Kind: instance method of Nlu
Access: public

nlu.setConfirmSlot(field)

主动发起对一个槽位的确认,此时还需同时返回询问的outputSpeach。 主动发起的确认,DM不会使用默认配置的话术。

Kind: instance method of Nlu
Access: public

Param Type Description
field string 槽位名

Example

this.setConfirmSlot('destination');

nlu.setConfirmIntent()

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

Kind: instance method of Nlu
Access: public
Example

this.setConfirmIntent();

nlu.getSlotConfirmationStatus(field, index) ⇒ string

获取一个slot对应的confirmationStatus

Kind: instance method of Nlu
Returns: string - 槽位的confirmationStatus

Param Type Default Description
field string 槽位名
index number 0 index

nlu.getIntentConfirmationStatus(index) ⇒ string

获取意图的确认状态 获取一个intent对应的confirmationStatus

Kind: instance method of Nlu
Returns: string - 意图的confirmationStatus

Param Type Default Description
index number 0 index

nlu.setAfterSearchScore(score)

设置afterSearchScore

Kind: instance method of Nlu

Param Type Description
score number score

nlu.getAfterSearchScore() ⇒ number

获取afterSearchScore

Kind: instance method of Nlu