【问题标题】:Detecting arbitrary amount of intents using Dialogflow使用 Dialogflow 检测任意数量的意图
【发布时间】:2020-10-29 12:39:58
【问题描述】:

在 Dialogflow(ES 版本)中,我们的意图是检测产品名称和可选数量。例如。 Do you have Pepsi 或 I need 4 apples。我们还有一些包含不止一种产品的训练示例。例如:I need 2 brush and 3 chocolates.

总体思路是让实体抽取通用化,这样我们就可以查询n的产品数量。例如,1 Pepsi, 2 eggs, 5 ice cream, and 4 tomatoes 将正确提取 4 种不同的产品。

但我们做了一些手动测试,发现实体提取通常不会扩展到任意数量的实体。这是 Dialogflow 的限制,还是我们需要调整我们的训练数据以包含更多具有 4/5+ 产品的示例?

我正在寻找有关使用任意数量的实体处理此类查询的建议。

对话流设置:

ML Threshold: 0.3

实体:

Product: Some product names as training data. **Automated expansion** and **Fuzzy matching** enabled.
Product-count: @sys.number. All options disabled 

Product_Query 意图参数:

+----------------+----------------+------+
| Parameter Name |     Entity     | Type |
+----------------+----------------+------+
| products       | @Products      | List |
| product-count  | @Product-count | List |
+----------------+----------------+------+

【问题讨论】:

  • 嗨 Jahirul,您能否在对话框流中包含一些参数设置的屏幕截图?如果我们对您如何设置实体提取有更多了解,就可以更轻松地为您提供建议。
  • 当然。我在帖子中添加我的实体和意图配置
  • 嗨,@Jordi,我已经用一些 Dialogflow 设置更新了帖子。如果需要更多信息,请告诉我。谢谢
  • 啊,抱歉发布了不正确的答案,我误解了这个问题。据我所知,列表中的实体数量没有具体限制。您是否尝试过使用简单的用例进行测试,比如尝试检测 10 个数字?
  • 不用担心。感谢您的努力。我确实尝试过,结果屡试不爽。这就是为什么我想从其他拥有更多 Dialogflow 知识的人那里得到一些建议

标签: nlp dialogflow-es nlu


【解决方案1】:

我创建了两个实体:@products 和 @count:

@products         @count       *it sounds dumb to use this @count but is useful for 
banana            1             this example
apple             2
pepsi             3
cocacola          4 
pear              5
orange            6
juice             7
book              8 

然后我创建了一个名为 products_detection 的意图并添加了训练短语:

I want 1 banana, 2 apples, 3 juices, 4 pear, 5 orange, 6 book, 7 cocacola, 8 pepsi

单击输入后,Dialogflow 会将句子单词与实体匹配,并为每个实体分配不同的值。他还从apples 和juices 中提取实体,尽管它们在训练短语中是复数形式。

我只是想尝试一下它是否可以与单个训练句子一起使用,并且效果出奇的好。首先我尝试了相同的训练语句,结果是:

"parameters": {
      "count2": "3",
      "count14": "7",    <-------------
      "count": "1",                    | You can see that the product and count
      "products14": "cocacola",   <----  matches for all products
      "products13": "book",
      "products12": "orange",
      "count12": "5",
      "count21": "8",
      "count11": "4",
      "count1": "2",
      "products21": "pepsi",
      "count13": "6",
      "products2": "juice",
      "products": "banana",
      "products1": "apple",
      "products11": "pear"
    },

然后我将数字和产品混合并尝试使用以下短语:

I want 5 banana, 8 apples, 7 juices, 3 pepsi, 1 cocacola, 2 orange, 4 book, 6 pear

我得到:

"parameters": {
      "count1": "8",
      "count12": "1",
      "count14": "4",
      "count21": "6",
      "products13": "orange",
      "count11": "3",
      "products14": "book",
      "products2": "juice",
      "count": "5",
      "products21": "pear",
      "products1": "apple",
      "products12": "cocacola",
      "count2": "7",
      "products": "banana",
      "products11": "pepsi",
      "count13": "2"
    },

如您所见,产品仍与计数匹配,这里有超过 5 个产品。

【讨论】:

  • 感谢您的回答。但是如果产品不包含在实体列表中,它会起作用吗?例如,如果我说“我想要 2 个巨无霸、3 个芬达和 1 个书”。
  • 我只是指出了一个包含超过 5 个实体提取的示例,但是这样不会识别实体列表中未包含的产品。如果查询中有重复的数字,我什至不知道它是否会起作用。您在最初的方法中使用了哪些训练短语?
猜你喜欢
  • 2020-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-18
  • 1970-01-01
  • 1970-01-01
  • 2019-01-08
相关资源
最近更新 更多