搭建 rasa 框架中遇到的 domain.yml 无效问题

背景描述

今天在用 rasa 模型构造任务型机器人的过程中,项目原来为:输入餐厅、用餐人数后推荐餐厅的对话型机器人。期望将项目修改为:输入时间、餐厅、用餐人数后推荐餐厅的对话机器人。

错误描述

Your form ‘restaurant_form’ uses an invalid slot mapping of type ‘form_entity’ for slot ‘order_datetime’

解决方案

type: from_entity 误写成了 type:form_entity。(流下了写习惯了前端 form 表单的泪水)

完整修改代码

domain.yml

version: "2.0"

#rasa train --domain path_to_domain_directory if multiple domain files

intents:
  - say_hi
  - thankyou
  - goodbye
  - affirm
  - deny
  - recognition
  - nlu_fallback
  - out_of_scope
  - request_restaurant


slots:
  order_datetime:
    type: text
  plant:
    type: text
  cuisine:
    type: text
  num_people:
    type: float


entities:
  - order_datetime
  - plant
  - cuisine
  - num_people

responses:
  utter_say_hi:
  - text: "你好,很高兴认识你!"
  - text: "hi, 我是小鹰,记得关注我哦。"
  utter_no_thanks:
  - text: "不用谢。"
  - text: "you are welcomed."
  utter_goodbye:
  - text: "byebye."
  - text: "再见"
  utter_ask_restaurant_form_cuisine:
  - text: "请问要订什么类型的餐厅?"
  utter_ask_restaurant_form_num_people:
  - text: "有几个人就餐?"
  utter_ask_restaurant_form_order_datetime:
    - text: "什么时间的?"
  utter_restaurant_done:
  - text: "好的,已帮您预订 {order_datetime} 的餐厅:{cuisine},人数:{num_people}"
  


forms:
  restaurant_form:
    required_slots:
      order_datetime:
        - type: from_entity
          entity: order_datetime
      cuisine:
        - type: from_entity
          entity: cuisine
      num_people:
        - type: from_entity
          entity: num_people
actions:
 - action_recognize
 - utter_say_hi
 - utter_no_thanks
 - utter_goodbye
 - action_chitchat
 - action_resetSlot


session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

nlu.yml

version: "2.0"

nlu:
- intent: say_hi
  examples: |
    - 你好
    - 小鹰小鹰
    - 早上好
    - hi
    - hello
    
- intent: thankyou
  examples: |
    - 谢谢
    - 感谢
    - 多谢
    - thank you
    - thanks

- intent: goodbye
  examples: |
    - 再见
    - 就这样吧
    - 再会
    - bye
    
- intent: out_of_scope
  examples: |
    - 来聊聊吧
    - 你长得好看不
    - 吃饭了
    - 起来嗨
    - 下班了
    
- intent: request_restaurant
  examples: |
    - 给我订个餐厅
    - 我想订个餐厅
    - 你会订餐厅吗
    - [中餐厅]{"entity":"cuisine"}
    - [西餐厅]{"entity":"cuisine"}
    - [川菜馆]{"entity":"cuisine"}
    - [火锅]{"entity":"cuisine"}
    - [3]{"entity":"num_people"}个人
    - [5]{"entity":"num_people"}人
    - [9]{"entity":"num_people"}位
    - [7]{"entity":"num_people"}人
    - [明天]{"entity": "order_datetime"}
    - [今天]{"entity": "order_datetime"}的
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

悄悄地努力

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值