1. domain
domain定义了机器人可操作的数据范围,包括意图(intents)、实体(entities)、词槽(slots)、回复(responses)、表单(form)、动作(actions)和会话session的配置(session_config)。
- domain对模型的输入和输出进行明确的范围指定
❃ 意图、实体:输入的范围
❃ 词槽、表单:内部的变量,表征状态和存储记忆
❃ 动作:模型输出的范围
❃ 回复:机器人回复的模板
- 可以定义为多个YAML文件,domain内容会被读取并自动合并在一起。
# 调用指定domain文件训练模型
rasa train --domain configs/domain.yml
完整的domain示例:
version: "3.1"
intents:
- affirm
- deny
- greet
- thankyou
- goodbye
- search_concerts
- search_venues
- compare_reviews
- bot_challenge
- nlu_fallback
- how_to_get_started
entities:
- name
slots:
concerts:
type: list
influence_conversation: false
mappings:
- type: custom
venues:
type: list
influence_conversation: false
mappings:
- type: custom
likes_music:
type: bool
influence_conversation: true
mappings:
- type: custom
responses:
utter_greet:
- text: "嘿!"
utter_goodbye:
- text: "再见 :("
utter_default:
- text: "抱歉,我没听清,你能重复说一下吗?"
utter_youarewelcome:
- text: "不客气。"
utter_iamabot:
- text: "我是一个机器人,由 Rasa 驱动。"
utter_get_started:
- text: "我可以帮你找到音乐会和场地。你喜欢音乐吗?"
utter_awesome:
- text: "太棒了!你可以问我诸如“给我找一些音乐会”或“什么是好场地”之类的问题"
actions:
- action_search_concerts
- action_search_venues
- action_show_concert_reviews
- action_show_venue_reviews
- action_set_music_preference
session_config:
session_expiration_time: 60 # 以分钟为单位的值
carry_over_slots_to_new_session: true
2. 意图
列出在NLU数据
和对话训练数据
中使用的所有的意图。
参数:
- use_entities:[]——显式仅考虑某些实体
- ignore_entities:[]——忽略某些实体
intents:
- greet:
use_entities: