Rasa 查找 table 在训练数据中抛出错误 - “不是有效的 NLU 数据”
Rasa lookup table throws error in training data - " Not a valid NLU data"
我正在使用 RASA 构建一个气象机器人,并希望我的模型能够将位置提取为实体。我的模型无法识别训练数据之外的位置。因此,我决定对其他实体使用 lookup tables。
我遵循了博客文章 Entity extraction with lookup tables 并使用查找 table 通过在数据文件夹下创建查找“.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"
}
]
}
]
}
}
我的查找 table 的位置名称各占一行。
但是,当我 运行 'rasa train nlu' 时,出现以下错误:“路径‘数据’中不包含有效的 NLU 数据。请验证数据格式。现在将跳过 NLU 模型训练。" 可能是什么原因?我只做了博客里说的。请告诉我哪里出错了。提前致谢
这实际上与查找无关,通过加载您的数据我可以看到您在查找和常见示例之间缺少一个逗号,它应该如下所示:
{
"rasa_nlu_data": {
"lookup_tables": [
{
"name": "location",
"elements": "data/location.txt"
}
],
"common_examples"
...
这表明您可能 writing/editing json 手动;考虑使用 markdown 并在需要时使用 rasa data convert
获取 json
我正在使用 RASA 构建一个气象机器人,并希望我的模型能够将位置提取为实体。我的模型无法识别训练数据之外的位置。因此,我决定对其他实体使用 lookup tables。
我遵循了博客文章 Entity extraction with lookup tables 并使用查找 table 通过在数据文件夹下创建查找“.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"
}
]
}
]
}
}
我的查找 table 的位置名称各占一行。
但是,当我 运行 'rasa train nlu' 时,出现以下错误:“路径‘数据’中不包含有效的 NLU 数据。请验证数据格式。现在将跳过 NLU 模型训练。" 可能是什么原因?我只做了博客里说的。请告诉我哪里出错了。提前致谢
这实际上与查找无关,通过加载您的数据我可以看到您在查找和常见示例之间缺少一个逗号,它应该如下所示:
{
"rasa_nlu_data": {
"lookup_tables": [
{
"name": "location",
"elements": "data/location.txt"
}
],
"common_examples"
...
这表明您可能 writing/editing json 手动;考虑使用 markdown 并在需要时使用 rasa data convert
获取 json