1
votes

In Dialogflow (ES version), we have an intent for detecting product names and optional quantities. E.g. Do you have Pepsi or I need 4 apples. We also have some training examples that contain more than one product. E.g: I need 2 brush and 3 chocolates.

The general idea is to make the entity extraction generic so that we can query with n number of products. For example, 1 Pepsi, 2 eggs, 5 ice cream, and 4 tomatoes will extract the 4 different products correctly.

But we did some manual testing and found that the entity extraction does not generally extend to an arbitrary number of entities. Is that a limitation of Dialogflow or do we need to tune our training data to include more examples with 4/5+ products?

I am looking for suggestions on handling this type of query with an arbitrary amount of entities.

Dialogflow Setup:

ML Threshold: 0.3

Entities:

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

Product_Query intent parameters:

+----------------+----------------+------+
| Parameter Name |     Entity     | Type |
+----------------+----------------+------+
| products       | @Products      | List |
| product-count  | @Product-count | List |
+----------------+----------------+------+
1
Hi Jahirul, could you include some screenshots of your parameter setup in dialogflow? It makes it easier to advice you with your question if we know more about how you setup the entity extraction. - Jordi
Sure. I'm adding my entity and intent configuration in the post - Jahir
Hi, @Jordi, I've updated the post with some Dialogflow setup. Let me know if more info is required. Thanks - Jahir
Ah, sorry for posting an incorrect answer, I misunderstood the question. As far as I know there isn't a specific limit to the amount of entities that can go in a list. Have you tried testing this with a simple usecase, say by trying to detect 10 numbers? - Jordi
No worries. Thanks for the effort. I did try and the results were hit and miss. That's why I wanted some advice from others who have more Dialogflow knowledge - Jahir

1 Answers

1
votes

I created two entities: @products and @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 

Then I created an intent called products_detection and I added the training phrase:

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

Once you click enter Dialogflow matches the sentence words with the entities and assigns each of them a different value. He also takes the entities from apples and juices although they are plural in the training phrase.

I just wanted to try if it could work with a single training sentence and it worked surprisingly good. First I tried with the same training sentence and the result is:

"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"
    },

Then I mixed the numbers and products and tried with the phrase:

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

And I get:

"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"
    },

As you can see the products are still matching with the counts, and here there are more than 5 products.