New date time entities in LUIS
Previously we announced new number recognition in LUIS, but this was just the beginning! There are many more features coming to LUIS and the Bot Framework, of which today we are excited to announce that LUIS now has new pre-built date time entities which not only provide more accurate date-time recognition, but also contextual recognition for date ranges. Let’s dive into what this means.
Old time entity limitations
Just like there are many ways in language and speech which humans can represent numbers, there are many different ways humans represent time and dates. Here’s just a few examples of how we casually refer to abstractions of time in every day conversation:
Let’s meet this Saturday
I would like to book a flight between May 1st and May 5th
That event is on the first week of next year
Using the old pre-built number entities in LUIS, the developer had to be very specific with how they managed dates, consider the following exanple of a query and result using the old LUIS date time entities:
The result from the query passed in actually returned two separate time entity objects. Now let’s take a look at what the new pre-built time entities LUIS’ is capable of handling.
New LUIS time entity capability and features
Past and Future date resolution to handle ambiguity
Previously, if a user passed in a random ambiguous date with no reference with respect to time, LUIS would recognize a date entity with a string format on resolution
"date" : "XXXX-01-10" which didn’t provide the developer with much flexibility. Contrast this to the new entity behavior, if a year isn’t specified, by default LUIS will provide you with both the most immediate past and future years as values in the resolution.
What about more specific dates? Don’t worry, that’s also taken care of. The following example shows what happens when a user submits a query for this saturday and next saturday.
Date range recognition
daterange is now a separate type of datetime entity that LUIS will recognize based on a date range in a user query. Previously, LUIS would recognize two separate time entities and it would be up to the developer to handle the data formatting logic from their application. Because LUIS will now return a usable and simple to understand date range on resolution, developers will no longer need to do this, freeing up development time and resources.
More complex queries and casual conversation
In natural day to day speech and conversation, we often aren’t very specific with referring to time abstractions. Consider the following old and new LUIS response for a query of
First week of next year
LUIS can now not only identify a contextual datetime object in natural language, and also use that context (in this example both a future time and a range) to provide a datetime object that’s useful for developers to use!
Matthew Shim and Carol Hanna from the Bot Framework Team