How to use the @microsoft/recognizers-text-number.Culture.Chinese function in @microsoft/recognizers-text-number

To help you get started, we’ve selected a few @microsoft/recognizers-text-number 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-number-with-unit / src / numberWithUnit / numberWithUnitRecognizer.ts View on Github external
[new NumberWithUnitExtractor(new PortugueseTemperatureExtractorConfiguration()), new NumberWithUnitParser(new PortugueseTemperatureParserConfiguration())]
        ])));
        this.registerModel("DimensionModel", Culture.Portuguese, (options) => new DimensionModel(new Map([
            [new NumberWithUnitExtractor(new PortugueseDimensionExtractorConfiguration()), new NumberWithUnitParser(new PortugueseDimensionParserConfiguration())]
        ])));
        this.registerModel("AgeModel", Culture.Portuguese, (options) => new AgeModel(new Map([
            [new NumberWithUnitExtractor(new PortugueseAgeExtractorConfiguration()), new NumberWithUnitParser(new PortugueseAgeParserConfiguration())]
        ])));
        // #endregion

        // #region Chinese
        this.registerModel("CurrencyModel", Culture.Chinese, (options) => new CurrencyModel(new Map([
            [new BaseMergedUnitExtractor(new ChineseCurrencyExtractorConfiguration()), new BaseMergedUnitParser(new ChineseCurrencyParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishCurrencyExtractorConfiguration()), new NumberWithUnitParser(new EnglishCurrencyParserConfiguration())]
        ])));
        this.registerModel("TemperatureModel", Culture.Chinese, (options) => new TemperatureModel(new Map([
            [new NumberWithUnitExtractor(new ChineseTemperatureExtractorConfiguration()), new NumberWithUnitParser(new ChineseTemperatureParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishTemperatureExtractorConfiguration()), new NumberWithUnitParser(new EnglishTemperatureParserConfiguration())]
        ])));
        this.registerModel("DimensionModel", Culture.Chinese, (options) => new DimensionModel(new Map([
            [new NumberWithUnitExtractor(new ChineseDimensionExtractorConfiguration()), new NumberWithUnitParser(new ChineseDimensionParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishDimensionExtractorConfiguration()), new NumberWithUnitParser(new EnglishDimensionParserConfiguration())]
        ])));
        this.registerModel("AgeModel", Culture.Chinese, (options) => new AgeModel(new Map([
            [new NumberWithUnitExtractor(new ChineseAgeExtractorConfiguration()), new NumberWithUnitParser(new ChineseAgeParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishAgeExtractorConfiguration()), new NumberWithUnitParser(new EnglishAgeParserConfiguration())]
        ])));
        // #endregion

        // #region Japanese
        this.registerModel("CurrencyModel", Culture.Japanese, (options) => new CurrencyModel(new Map([
            [new BaseMergedUnitExtractor(new JapaneseCurrencyExtractorConfiguration()), new BaseMergedUnitParser(new JapaneseCurrencyParserConfiguration())],
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number-with-unit / src / numberWithUnit / chinese / currency.ts View on Github external
constructor(ci?: CultureInfo) {
        if (!ci) {
            ci = new CultureInfo(Culture.Chinese);
        }

        super(ci);

        this.extractType = Constants.SYS_UNIT_CURRENCY;

        // Reference Source: https:// en.wikipedia.org/wiki/List_of_circulating_currencies
        this.suffixList = ChineseNumericWithUnit.CurrencySuffixList;
        this.prefixList = ChineseNumericWithUnit.CurrencyPrefixList;
        this.ambiguousUnitList = ChineseNumericWithUnit.CurrencyAmbiguousValues;;
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number-with-unit / src / numberWithUnit / numberWithUnitRecognizer.ts View on Github external
this.registerModel("CurrencyModel", Culture.Portuguese, (options) => new CurrencyModel(new Map([
            [new NumberWithUnitExtractor(new PortugueseCurrencyExtractorConfiguration()), new NumberWithUnitParser(new PortugueseCurrencyParserConfiguration())]
        ])));
        this.registerModel("TemperatureModel", Culture.Portuguese, (options) => new TemperatureModel(new Map([
            [new NumberWithUnitExtractor(new PortugueseTemperatureExtractorConfiguration()), new NumberWithUnitParser(new PortugueseTemperatureParserConfiguration())]
        ])));
        this.registerModel("DimensionModel", Culture.Portuguese, (options) => new DimensionModel(new Map([
            [new NumberWithUnitExtractor(new PortugueseDimensionExtractorConfiguration()), new NumberWithUnitParser(new PortugueseDimensionParserConfiguration())]
        ])));
        this.registerModel("AgeModel", Culture.Portuguese, (options) => new AgeModel(new Map([
            [new NumberWithUnitExtractor(new PortugueseAgeExtractorConfiguration()), new NumberWithUnitParser(new PortugueseAgeParserConfiguration())]
        ])));
        // #endregion

        // #region Chinese
        this.registerModel("CurrencyModel", Culture.Chinese, (options) => new CurrencyModel(new Map([
            [new BaseMergedUnitExtractor(new ChineseCurrencyExtractorConfiguration()), new BaseMergedUnitParser(new ChineseCurrencyParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishCurrencyExtractorConfiguration()), new NumberWithUnitParser(new EnglishCurrencyParserConfiguration())]
        ])));
        this.registerModel("TemperatureModel", Culture.Chinese, (options) => new TemperatureModel(new Map([
            [new NumberWithUnitExtractor(new ChineseTemperatureExtractorConfiguration()), new NumberWithUnitParser(new ChineseTemperatureParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishTemperatureExtractorConfiguration()), new NumberWithUnitParser(new EnglishTemperatureParserConfiguration())]
        ])));
        this.registerModel("DimensionModel", Culture.Chinese, (options) => new DimensionModel(new Map([
            [new NumberWithUnitExtractor(new ChineseDimensionExtractorConfiguration()), new NumberWithUnitParser(new ChineseDimensionParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishDimensionExtractorConfiguration()), new NumberWithUnitParser(new EnglishDimensionParserConfiguration())]
        ])));
        this.registerModel("AgeModel", Culture.Chinese, (options) => new AgeModel(new Map([
            [new NumberWithUnitExtractor(new ChineseAgeExtractorConfiguration()), new NumberWithUnitParser(new ChineseAgeParserConfiguration())],
            [new NumberWithUnitExtractor(new EnglishAgeExtractorConfiguration()), new NumberWithUnitParser(new EnglishAgeParserConfiguration())]
        ])));
        // #endregion
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / dateTimeRecognizer.ts View on Github external
// #region EnglishOhters
        this.registerModel("DateTimeModel", Culture.EnglishOthers, (options) => new DateTimeModel(
            new BaseMergedParser(new EnglishMergedParserConfiguration(new EnglishCommonDateTimeParserConfiguration(true)), this.Options),
            new BaseMergedExtractor(new EnglishMergedExtractorConfiguration(true), this.Options)
        ));
        // #endregion

        // #region Spanish
        this.registerModel("DateTimeModel", Culture.Spanish, (options) => new DateTimeModel(
            new BaseMergedParser(new SpanishMergedParserConfiguration(), this.Options),
            new BaseMergedExtractor(new SpanishMergedExtractorConfiguration(), this.Options)
        ));
        // #endregion

        // #region Chinese
        this.registerModel("DateTimeModel", Culture.Chinese, (options) => new DateTimeModel(
            new ChineseFullMergedParser(),
            new ChineseMergedExtractor(this.Options)
        ));
        // #endregion

        // #region French
        this.registerModel("DateTimeModel", Culture.French, (options) => new DateTimeModel(
            new BaseMergedParser(new FrenchMergedParserConfiguration(), this.Options),
            new BaseMergedExtractor(new FrenchMergedExtractorConfiguration(), this.Options)
        ));
        // #endregion
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number-with-unit / src / numberWithUnit / chinese / dimension.ts View on Github external
constructor(ci?: CultureInfo) {
        if (!ci) {
            ci = new CultureInfo(Culture.Chinese);
        }

        super(ci);

        this.BindDictionary(ChineseNumericWithUnit.DimensionSuffixList);
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / chinese / durationConfiguration.ts View on Github external
constructor() {
        super(new CultureInfo(Culture.Chinese));

        this.extractType = Constants.SYS_DATETIME_DURATION;
        this.suffixList = ChineseDateTime.DurationSuffixList;
        this.prefixList = new Map();
        this.ambiguousUnitList = ChineseDateTime.DurationAmbiguousUnits;
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number-with-unit / src / numberWithUnit / chinese / age.ts View on Github external
constructor(ci?: CultureInfo) {
        if (!ci) {
            ci = new CultureInfo(Culture.Chinese);
        }

        super(ci);

        this.extractType = Constants.SYS_UNIT_AGE;

        this.suffixList = ChineseNumericWithUnit.AgeSuffixList;
        this.prefixList = new Map();
        this.ambiguousUnitList = ChineseNumericWithUnit.AgeAmbiguousValues;
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number-with-unit / src / numberWithUnit / chinese / temperature.ts View on Github external
constructor(ci?: CultureInfo) {
        if (!ci) {
            ci = new CultureInfo(Culture.Chinese);
        }

        super(ci);

        this.extractType = Constants.SYS_UNIT_TEMPERATURE;

        this.suffixList = ChineseNumericWithUnit.TemperatureSuffixList;
        this.prefixList = ChineseNumericWithUnit.TemperaturePrefixList;
        this.ambiguousUnitList = ChineseNumericWithUnit.TemperatureAmbiguousValues;

        this.ambiguousUnitNumberMultiplierRegex = RegExpUtility.getSafeRegExp(BaseUnits.AmbiguousUnitNumberMultiplierRegex, "gs");
    }
}

@microsoft/recognizers-text-number

recognizers-text-number provides robust recognition and resolution of numbers expressed in multiple languages.

MIT
Latest version published 1 year ago

Package Health Score

79 / 100
Full package analysis