Duckling Time Extraction


I am currently using duckling to extract time values to create appointment. Since a person is allowed to send this message as two different messages, there are time when the messages come as the following:

– Can I come in tomorrow

– Sure what time?

– 3PM

This would create an appointment at 3PM tomorrow b/c duckling is able to extract tomorrow in the first message and 3PM in the second message.

However, if the time is given as just ‘3’, the time entity is not extracted by duckling.

Is it possible to have duckling recognize a single number (such as 3) as a time?

Thank you!!


1 Like

Hey @abhi, great question! Whether 3 is a time or a number of pizza slices, and whether it means 3pm or 3am, depends on the context. And Duckling doesn’t know this context, so it can’t help you directly :wink:

What you can do is to extract not just times but also numbers with Duckling (i.e. dimensions: ["time", "number", ...]. Assuming your bot asks about the time within a form, you’d then create a form validation action in which you can do some clever post-processing of the extracted number entity (e.g. add pm or am to it) and fill your time slot accordingly.

Let me know if this helps!


Hey @SamS!

That makes a lot of sense. That is one of the routes I realized I might have to take. I wanted to be sure there wasn’t something else that I could do beyond treating it like a number and processing it. I will make that change and see how it works!

Thank you for the help!!!



This post was flagged by the community and is temporarily hidden.