提取实体而不在意图规范期间指定

Extract entities without specifying during intent specification

我正在使用 Rasa 2.0 构建一个 FAQ 聊天机器人,其中我有一个大型数据集,并且在定义意图时指定实体对我来说似乎效率不高。

我有 nlu.yml 中定义的意图和示例,想提取实体。

这是我想要实现的示例,

用户留言 -> 我想要德里的一家医院。 实体 -> 德里,医院

可以吗?

您可以在您的 nlu 训练数据中使用 entity annotations;例如,假设您已将 building_typecity 定义为实体名称:

I want a [hospital]("building_type") in [Delhi]("city").

或者,您可以尝试以下选项:

  • 注释较小的样本(例如,那些对您的 FAQ 助手必不可少的实体)
  • 使用RegexEntityExtractor写一些规则
  • 如果您有实体列表,可以使用lookup tables生成正则表达式

实体检测还没有解决。存在与 Rasa 集成的预训练模型,例如 Duckling and spaCy and while these tools certainly contribute a lot of knowledge, they will make errors. If you're interested in learning more of the background on why these models can certainly fail, you can enjoy this youtube video that explains human name detection

这就是为什么流行的替代方法是使用名单。有世界各地的城市列表以及您可以下载的婴儿名字列表,这些列表可以用作基于规则的替代方案。您可以通过 RegexEntityExtractor but if you have namelists with 1000+ items then a FlashTextExtractor 在 Rasa 中配置它可能更可取。

如果您有带标签的示例,您还可以训练 Rasa 本身来识别实体。但是为了做到这一点,你将有标签。

specifying entities while defining intents does not seem efficient to me

贴标签可能不是很有趣,但它非常有效。如果不标记您收到的话语,您将不知道您的用户对什么意图感兴趣。