首页 > 解决方案 > rasa nlu 中相似词的意图识别不正确

问题描述

当用户询问包含在定义意图中使用的一些关键字(帮助词构建句子)的out_of_scope问题时,它会选择定义的意图(我没有使用任何实体方法)。

配置.yml

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline: supervised_embeddings

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
    max_history: 5
  - name: KerasPolicy
    epochs: 400
    batch_size: 100
    validation_split: 0.2
    max_history: 5
  - name: MappingPolicy
  - name: "FallbackPolicy"
    nlu_threshold: 0.7
    core_threshold: 0.5
    fallback_action_name: "action_default_fallback"

以下是我的意图

intent: ask_faq_how_many _vegetarian_restaurants_are_there_nearby
- how many vegetarian restaurants are there nearby
- vegetarian restaurants near by
- please tell me how many vegetarian restaurants are there

如果用户问:

  1. “我有什么素食选择”?
  2. “你喜欢素食吗?”
  3. “素食”

然后 nlu 选择 ask_faq_how_many _vegetarian_restaurants_are_there_nearby 作为意图。

以上 3 个问题与任何意图无关,用户可以使用上述关键字进行许多其他闲聊,并且训练所有关键字可能需要很长时间。有什么方法可以告诉 nlu 不要仅根据几个关键字来选择意图?

标签: rasa-nlurasa-corerasa

解决方案


我建议建立一个映射尽可能多的实体的意图。因此,如果在输入中未找到这些实体,则在针对此意图的自定义操作中,尽管基于使用的关键字有很强的信心,但您知道映射是错误的。

在您的情况下 ask_faq_how_many_vegetarian_restaurants_are_there_nearby,创建映射(1)数字方面的训练示例,以及(2)您想要实际上是餐厅的商店。

- how [many](number) vegetarian [restaurant](shops)s are there nearby 
- are there [many](number) vegetarian [restaurant](shops)s nearby

意图越具体,带有正确关键字的闲聊消息的置信度就会降低,缺失的实体应该确认匹配是错误的。

希望这可以帮助!


推荐阅读