如何在 Rasa 中使用 nlu.md 中的类似示例进行意图分类

How to Intent classification with similar examples in nlu.md in Rasa

我正在使用 Rasa 为合同经理组织开发聊天机器人。我面临的问题很少,在论坛和 Rasa 博客上阅读了大量内容后,我无法得出解决方案。我有几个类似的意图和类似的例子,比如 -

“inform_supplier_start_date” and “inform_contract_start_date”.
“inform_supplier_email” and “inform_customer_email” and “inform_reviewer_email”

现在的问题是,对于两种意图类别,nlu.md 中的例句是相同的。我的意思是-

##intent:inform_suppler_start_date
-what is the supplier  [Microsoft] (supplier_name) start date
-[EON Digital] (supplier_name) start date

##intent:inform_contract_start
1) start-date of [O2 Mobile phones] (contract_name) 
2) [O2 Mobile phones] (contract_name) start date

该模型无法区分和识别正确的意图。它变得混乱并识别出错误的意图,因为这些意图中的词语是相似的。

我需要识别正确的意图,因此,在自定义操作中,我可以查询数据库并获得供应商和合同的相应结果。

我有很多这样的字段,示例数据和用户查询都是相同的。例如-

customer_email & supplier_email & reviewer_email
total_spend_contract & total_spend_supplier & total_spend_customer
contract_number_for_supplier & contract_number_of_contract & contract_number_organisation

我应该怎么做才能获得正确的分类。我正在考虑的一种解决方案是将“supplier_start_date”和“"contract_start_date"”之类的意图合并为一个“start_date”,并在供应商和合同数据库的自定义操作中检查提取的实体。但我认为这不是自然语言的正确用法。

请指教,不胜感激。问候。

由于您的意图示例非常相似,模型将无法区分它们。此外,意图实际上是相同的,inform_suppler_start_dateinform_contract_start 通知机器人关于开始日期。应该通过实体识别来确定它是什么样的开始日期。所以我建议合并相似的意图并检查实体识别检测到的实体。根据是否找到供应商或合同,您可以执行查询 A 或 B。