我正在使用RASA构建天气机器人,并希望我的模型能够将位置提取为实体。我的模型无法识别出训练数据之外的位置。因此,我决定对其他实体使用查找表。
[我关注博客文章Entity extraction with lookup tables,并使用查找表通过在数据文件夹下创建查找“ .txt”文件来识别训练数据中的位置实体。
这是我的训练数据的样子:
{
"rasa_nlu_data": {
"lookup_tables": [
{
"name": "location",
"elements": "data/location.txt"
}
]
"common_examples": [
{
"text": "Hello",
"intent": "greet",
"entities": []
},
{
"text": "goodbye",
"intent": "goodbye",
"entities": []
},
{
"text": "What's the weather in Berlin at the moment?",
"intent": "inform",
"entities": [
{
"start": 22,
"end": 28,
"value": "Berlin",
"entity": "location"
}
]
},
{
"text": "hey",
"intent": "greet",
"entities": []
},
{
"text": "hello",
"intent": "greet",
"entities": []
},
{
"text": "hi",
"intent": "greet",
"entities": []
},
{
"text": "heya",
"intent": "greet",
"entities": []
},
{
"text": "howdy",
"intent": "greet",
"entities": []
},
{
"text": "hey there",
"intent": "greet",
"entities": []
},
{
"text": "bye",
"intent": "goodbye",
"entities": []
},
{
"text": "goodbye",
"intent": "goodbye",
"entities": []
},
{
"text": "bye bye",
"intent": "goodbye",
"entities": []
},
{
"text": "see ya",
"intent": "goodbye",
"entities": []
},
{
"text": "see you later",
"intent": "goodbye",
"entities": []
},
{
"text": "What's the weather today?",
"intent": "inform",
"entities": []
},
{
"text": "What's the weather in London today?",
"intent": "inform",
"entities": [
{
"start": 22,
"end": 28,
"value": "London",
"entity": "location"
}
]
},
{
"text": "Show me what's the weather in Paris",
"intent": "inform",
"entities": [
{
"start": 30,
"end": 35,
"value": "Paris",
"entity": "location"
}
]
},
{
"text": "I wonder what is the weather in Vilnius right now?",
"intent": "inform",
"entities": [
{
"start": 32,
"end": 39,
"value": "Vilnius",
"entity": "location"
}
]
},
{
"text": "what is the weather?",
"intent": "inform",
"entities": []
},
{
"text": "Tell me the weather",
"intent": "inform",
"entities": []
},
{
"text": "Is the weather nice in Barcelona today?",
"intent": "inform",
"entities": [
{
"start": 23,
"end": 32,
"value": "Barcelona",
"entity": "location"
}
]
},
{
"text": "I am going to London today and I wonder what is the weather out there?",
"intent": "inform",
"entities": [
{
"start": 14,
"end": 20,
"value": "London",
"entity": "location"
}
]
},
{
"text": "I am planning my trip to Amsterdam. What is the weather out there?",
"intent": "inform",
"entities": [
{
"start": 25,
"end": 34,
"value": "Amsterdam",
"entity": "location"
}
]
},
{
"text": "Show me the weather in Dublin, please",
"intent": "inform",
"entities": [
{
"start": 23,
"end": 29,
"value": "Dublin",
"entity": "location"
}
]
},
{
"text": "in London",
"intent": "inform",
"entities": [
{
"start": 3,
"end": 9,
"value": "London",
"entity": "location"
}
]
},
{
"text": "Lithuania",
"intent": "inform",
"entities": [
{
"start": 0,
"end": 9,
"value": "Lithuania",
"entity": "location"
}
]
},
{
"text": "Oh, sorry, in Italy",
"intent": "inform",
"entities": [
{
"start": 14,
"end": 19,
"value": "Italy",
"entity": "location"
}
]
},
{
"text": "Tell me the weather in Vilnius",
"intent": "inform",
"entities": [
{
"start": 23,
"end": 30,
"value": "Vilnius",
"entity": "location"
}
]
},
{
"text": "The weather condition in Italy",
"intent": "inform",
"entities": [
{
"start": 25,
"end": 30,
"value": "Italy",
"entity": "location"
}
]
},
{
"text": "I am going to Barcelona",
"intent": "inform",
"entities": [
{
"start": 14,
"end": 23,
"value": "Barcelona",
"entity": "location"
}
]
},
{
"text": "I'm planning a trip to Barcelona",
"intent": "inform",
"entities": [
{
"start": 22,
"end": 32,
"value": " Barcelona",
"entity": "location"
}
]
},
{
"text": "I am going to Barcelona. I wonder what is the weather out there?",
"intent": "inform",
"entities": [
{
"start": 13,
"end": 23,
"value": " Barcelona",
"entity": "location"
}
]
},
{
"text": "What is the weather in Argentina?",
"intent": "inform",
"entities": [
{
"start": 23,
"end": 32,
"value": "Argentina",
"entity": "location"
}
]
},
{
"text": "I am planning a trip to Paris and I wonder what is the weather out there?",
"intent": "inform",
"entities": [
{
"start": 24,
"end": 29,
"value": "Paris",
"entity": "location"
}
]
}
]
}
}
我的查询表在每行中都有一个位置名称。
但是,当我运行'rasa train nlu'时,出现以下错误:“ 路径'数据'中不包含有效的NLU数据。请验证数据格式。NLU模型训练将为现在跳过。“这可能是什么原因?我只做了博客中所说的。请告诉我我要去哪里了。在此先感谢
这实际上与查找无关,通过加载数据,我可以看到您缺少查找和常见示例之间的逗号,它看起来应该像这样:
{
"rasa_nlu_data": {
"lookup_tables": [
{
"name": "location",
"elements": "data/location.txt"
}
],
"common_examples"
...
这表明您可能正在手动编写/编辑json;考虑使用markdown并在需要时使用rasa data convert
获取json