Rasa 3天气聊天机器人训练报错:YAML语法与Slot映射问题
解决Rasa 3天气机器人训练报错问题
一、修复nlu.yml的YAML语法错误
报错源于三处问题:
- 带实体标注(
[]()格式)的句子未加引号,YAML解析器误将方括号识别为序列起始符; intent:city_info的冒号后缺少空格,违反YAML语法规范;- 部分实体标注存在空格(如
[Mumbai] (location)),会导致实体识别失效。
修改后的nlu.yml关键部分代码:
- intent: weather_for_location examples: - "what is the weather in [Noida](location)" - "what is the weather in [New Delhi](location)" - "weather of [Mumbai](location)" - "Today's weather in [Bangalore](location)" - "[Kolkata](location) weather" - "Tell me weather of [Hyderabad](location)" - "Can you tell me weather of [London](location)" - intent: city_info examples: - "[New Delhi](location)" - "[India](location)" - "[Mumbai](location)" - "[Noida](location)" - "[Kolkata](location)" - "[Bangalore](location)" - "[London](location)"
二、修复domain.yml的槽映射无效问题
Rasa 3要求槽映射必须遵循指定格式,不能直接使用键值对。由于location槽需要从同名实体提取值,需将映射类型设置为from_entity。
修改后的domain.yml中slots部分代码:
slots: location: type: text mappings: - type: from_entity entity: location influence_conversation: false
内容的提问来源于stack exchange,提问作者Nisarg Kudgunti
相关产品推荐
相关产品推荐

