This bot has been created using Bot Framework, is shows how to use TIMEX expressions.
A TIMEX expression is an alpha-numeric expression derived in outline from the standard date-time representation ISO 8601. The interesting thing about TIMEX expressions is that they can represent various degrees of ambiguity in the date parts. For example, May 29th, is not a full calendar date because we haven't said which May 29th - it could be this year, last year, any year in fact. TIMEX has other features such as the ability to represent ranges, date ranges, time ranges and even date-time ranges.
TIMEX expressions are produced as part of the output of running a DateTimeRecognizer against some natural language input. As the same Recognizers are run in LUIS the result returned in the JSON from a call to LUIS also contains the TIMEX expressions.
It turns out that TIMEX expressions are not that simple to work with in code. This library attempts to address that. One helpful way to think about a TIMEX expression is as a partially filled property bag. The properties might be such things as "day of week" or "year." Basically the more properties we have captured in the expression the less ambiguity we have.
The library can do various things:
- Parse TIMEX expressions to give you the properties contained there in.
- Generate TIMEX expressions based on setting raw properties.
- Generate natural language from the TIMEX expression. (This is logically the reverse of the Recognizer.)
- Resolve TIMEX expressions to produce example date-times. (This produces the same result as the Recognizer (and therefore LUIS)).
- Evaluate TIMEX expressions against constraints such that new more precise TIMEX expressions are produced.
The TIMEX expression library is contained in the same GitHub repo as the recognizers. Refer to the further reading section below.
-
Clone the repository
git clone https://github.com/microsoft/botbuilder-samples.git
-
In a terminal, navigate to
samples/javascript_nodejs/40.timex-resolution
cd samples/javascript_nodejs/40.timex-resolution
-
Install modules
npm install
-
Start the bot
npm start
Microsoft Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
- Install the Bot Framework emulator from here
- Launch Bot Framework Emulator
- File -> Open Bot
- Enter a Bot URL of
http://localhost:3978/api/messages