2

Suppose I have a query like:

Turn on the lights from 5pm to 11pm.

I have a time-period entity that matches "5pm to 11pm", and the agent correctly parses the entity into two DateTime objects in the response. However, I need to get a mapping of the snippets of original text to the parameter, i.e. Original Text -> Parameter Name, e.g. "5pm to 11pm" maps to the "time-period" entity. Ideally, I would like the original text along with the parsed objects. Is this possible?

arao6
  • 3,316
  • 5
  • 30
  • 51
  • Possible duplicate of [DialogFlow Fulfilment - How to get both original and default value for a parameter](https://stackoverflow.com/questions/53935387/dialogflow-fulfilment-how-to-get-both-original-and-default-value-for-a-paramet) – sid8491 Feb 18 '19 at 10:10

1 Answers1

2

If you are using just parameters, then it is not possible to get the original text from the user query. Dialogflow will only give you the parsed date. As you can see in the image below, there is only parsed startTime and endTime.

time-1

However, if you set a context in your intent, then you can get the value of both parsed date and the original text that user has entered. As you can see in the image below, there is both original text which is with .original suffix and the converted startDate and endDate.

time-2

You can set an output-context in the intent, with life-span of 1, just to get this value.

time-3

Hope it helps.

Community
  • 1
  • 1
sid8491
  • 6,622
  • 6
  • 38
  • 64