How to use the @microsoft/recognizers-text.MetaData function in @microsoft/recognizers-text

To help you get started, we’ve selected a few @microsoft/recognizers-text 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 / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / baseMerged.ts View on Github external
private assignModMetadata(metadata: MetaData): MetaData {

        if (metadata === undefined || metadata === null) {
            metadata = new MetaData();
            metadata.HasMod = true;
        } else {
            metadata.HasMod = true;
        }

        return metadata
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / chinese / dateTimeConfiguration.ts View on Github external
durationEr.forEach(er => {
            let pos = er.start + er.length;
            if (pos < source.length) {
                let suffix = source.substr(pos, 1);
                let beforeMatch = RegExpUtility.getMatches(ChineseDateTimeExtractor.beforeRegex, suffix).pop();
                let afterMatch = RegExpUtility.getMatches(ChineseDateTimeExtractor.afterRegex, suffix).pop();

                if (beforeMatch && suffix.startsWith(beforeMatch.value) || afterMatch && suffix.startsWith(afterMatch.value)) {
                    let metadata = new MetaData();
                    metadata.IsDurationWithAgoAndLater = true;
                    ret.push(new Token(er.start, pos + 1, metadata));
                }
            }
        });
        return ret;
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / chinese / dateConfiguration.ts View on Github external
durationEr.forEach(er => {
            if (!RegExpUtility.isMatch(ChineseDateExtractor.dateTimePeriodUnitRegex, er.text)) {
                let pos = er.start + er.length;
                if (pos < source.length) {
                    let suffix = source.substr(pos, 1);
                    let beforeMatch = RegExpUtility.getMatches(ChineseDateExtractor.beforeRegex, suffix).pop();
                    let afterMatch = RegExpUtility.getMatches(ChineseDateExtractor.afterRegex, suffix).pop();

                    if (beforeMatch && suffix.startsWith(beforeMatch.value) || afterMatch && suffix.startsWith(afterMatch.value)) {
                        let metadata = new MetaData();
                        metadata.IsDurationWithAgoAndLater = true;
                        ret.push(new Token(er.start, pos + 1, metadata));
                    }
                }
            }
        });
        return ret;