forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resolution.js
26 lines (20 loc) · 972 Bytes
/
resolution.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const { valueResolver } = require('@microsoft/recognizers-text-data-types-timex-expression');
// Given the TIMEX expressions it is easy to create the computed example values that the recognizer gives.
module.exports.examples = () => {
if (valueResolver === undefined) {
// see issue: https://github.com/Microsoft/Recognizers-Text/issues/974
console.error('ERR: package does not include valueResolver');
return;
}
// When you give the recognzier the text "Wednesday 4 o'clock" you get these distinct TIMEX values back.
const today = new Date();
const resolution = valueResolver.resolve(['XXXX-WXX-3T04', 'XXXX-WXX-3T16'], today);
console.log(resolution.values.length);
resolution.values.forEach(({ timex, type, value }) => {
console.log(timex);
console.log(type);
console.log(value);
});
};