rasa

slots

机器人的记忆, key-value结构, 来源可以是用户输入,或者是数据库查询

domain中的Slots 定义

slots:
  slot_name: // 定义的slot名称, 支持的类型有text, bool, categorical(类似枚举), float, list, any, 还可以自定义类型
    type: text  //类型
    influence_conversation// 默认true影响对话,  是否影响对话
    auto_fill:   //是否自动根据entity, 赋值给同名slot
    initial_value:  初始化值

Stories的五种元素

  1. 用户输入信息
- intent: intent_name  # Required
      entities:  # Optional  用户根据这里预测走向
      - entity_name: entity_value  //这个值,表示 ,如果entity是这个值这么走
  1. OR 表达式
- or:  //表示affirm 和thanks 都走相同的流程
    - intent: affirm
    - intent: thanks
  1. Actions
    3.1 Responses:
- action: utter_greet //utter_ 开头,内容在 domain中定义

3.2. Custom actions

- action: action_store_feedback// action_开头, 内容在domain中定义, actions server中实现
  1. Forms 是一个特殊的自定义action, 有一个循环的逻辑, 一直询问客户需要的slot, domain 中定义form,

  2. slot_was_set

  - intent: celebrate_bot
  - slot_was_set:
    - feedback_value: positive // 表示需要feedback_value 的值是positive
  1. Checkpoints
stories:
- story: story_with_a_checkpoint_1  
  steps:
  - intent: greet
  - action: utter_greet
  - checkpoint: greet_checkpoint  //会走到greet_checkpoint对应的点

- story: story_with_a_checkpoint_2
  steps:
  - checkpoint: greet_checkpoint
  - intent: book_flight
  - action: action_book_flight

Rule 和Story 区别
影响RASA会话流程的有2个配置,一个是Story,一个就是Rules,Story用于机器学习训练方式,而Rules就是基于规则的流程控制,只要满足规则,每次走的都是确定性分支.

问题记录

  1. 不能读取同名entity
    slots 中
  car:
    type: text
    auto_fill: false

改为

  car:
    type: text
    auto_fill: true
  1. nlu 识别准确路不高
  1. 数据量过少, 增加数据量

  2. 英文部分可能影响中文识别
    举例, 一个意图中的"goodbye"会影响 另一个意图中"了解" 相关的准确率

  1. 但数字识别问题
  • action: ask_age/ ask_num
  • intent: numberx
  • action: checkandset_slot

https://www.jianshu.com/p/3372a5c772ad
https://www.zhihu.com/column/c_1318281710002663424

原文地址:https://www.cnblogs.com/WillingCPP/p/14657909.html