How to use the @microsoft/recognizers-text-data-types-timex-expression.valueResolver.resolve function in @microsoft/recognizers-text-data-types-timex-expression

To help you get started, we’ve selected a few @microsoft/recognizers-text-data-types-timex-expression examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 40.timex-resolution / resolution.js View on Github external
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);
    });
};