3
votes

I have an issue developing an agent with dialogflow (api.ai). I am using a lot of entity values which are all different from one another. however there are similar synonyms for some entity values but the agent is returning only one value.

How can i get all the possible matches or ask question to resolve the ambiguity

for example i have an intent like: tell me the location of ABC express train

if my entity values are :
entity            synonym
15127             ABC express
12345             ABC express 

I want it to return two values or ask question to resolve such ambiguity how can i work this out Thanks in advance

1
This is not enough information. Post some example which will have entities, synonyms etc. - Vikasdeep Singh
I think i provided enough information. My concern is if i have many entity values with same synonym how can i deal with such a situation. api.ai is giving me only one entity value that it finds and not providing with all such matches similar issue is provided in the link if you find it useful discuss.api.ai/t/synonym-in-multiple-instances-of-one-entity/… - Sai Durga

1 Answers

7
votes

If you enable fulfillment for this intent, you can take a look at the value the user said and ask a further question if you need to disambiguate between entities.

Let's imagine you are extracting an entity called "trains". The parameters table in your intent might look like this:

Image of parameters table

By default, if the user says ABC express, the fulfillment webhook will be called with the following parameter hash:

"parameters": {
  "trains": "15127"
}

This isn't enough information to decide if the request was ambiguous, since train 15127 might also have non-ambiguous synonyms.

You can configure Dialogflow to send the original text of the entity, alongside the resolved value. This means you will receive the following information to your webhook:

"parameters": {
  "trains": "15127",
  "original": "ABC express"
}

You can then use some simple logic to ask a further question if the value of original appears in a list of known ambiguous synonyms.

To have Dialogflow send this data, modify your parameters table so it looks like the following:

Image of parameters table

This will cause the original synonym to be sent to Dialogflow alongside the resolved value.