【问题标题】:Incorrect intent recognition for similar words in rasa nlurasa nlu 中相似词的意图识别不正确
【发布时间】:2019-12-29 20:05:08
【问题描述】:

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

config.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-nlu rasa-core rasa


    【解决方案1】:

    我认为您的要求是不可能的。

    每个机器学习算法的工作原理都是通过学习使用您提供的数据来预测某些东西。因此,如果您的训练数据中的词 vegetarian 仅与一个意图相关联,那么它将其预测为该意图。没办法。

    但是,如果您希望它预测其他内容,那么您可以尝试使用相似数据放入更多意图,以便模型能够学会区分共享其词汇的不同意图。

    希望对您有所帮助。

    【讨论】:

      【解决方案2】:

      您是否尝试过拥有out_of_scope 意图并将那些闲聊的话语放在那里?我不能保证它会非常好,因为有很多交叉,但如果你没有其他地方可以对这些输入进行分类,它们肯定会达到那个目的。

      【讨论】:

      • 是的,我也使用了 out_of_scope 意图,但我无法通过添加来涵盖所有关键字,因为用户也可以询问 out_of_scope 意图以外的任何内容。
      • 是否有任何政策设置或管道可以改善这一点。
      【解决方案3】:

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

      在您的情况下 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
      

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

      希望这会有所帮助!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-07-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-16
        • 1970-01-01
        • 1970-01-01
        • 2018-01-06
        相关资源
        最近更新 更多