public DutchDateTimeExtractorConfiguration(IOptionsConfiguration config) : base(config) { IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(); DatePointExtractor = new BaseDateExtractor(new DutchDateExtractorConfiguration(this)); TimePointExtractor = new BaseTimeExtractor(new DutchTimeExtractorConfiguration(this)); DurationExtractor = new BaseDurationExtractor(new DutchDurationExtractorConfiguration(this)); UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); }
public DutchTimePeriodExtractorConfiguration(IOptionsConfiguration config) : base(config) { TokenBeforeDate = DateTimeDefinitions.TokenBeforeDate; SingleTimeExtractor = new BaseTimeExtractor(new DutchTimeExtractorConfiguration(this)); UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(); TimeZoneExtractor = new BaseTimeZoneExtractor(new DutchTimeZoneExtractorConfiguration(this)); }
public DutchCommonDateTimeParserConfiguration(IDateTimeOptionsConfiguration config) : base(config) { UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); UnitMap = DateTimeDefinitions.UnitMap.ToImmutableDictionary(); UnitValueMap = DateTimeDefinitions.UnitValueMap.ToImmutableDictionary(); SeasonMap = DateTimeDefinitions.SeasonMap.ToImmutableDictionary(); SpecialYearPrefixesMap = DateTimeDefinitions.SpecialYearPrefixesMap.ToImmutableDictionary(); CardinalMap = DateTimeDefinitions.CardinalMap.ToImmutableDictionary(); DayOfWeek = DateTimeDefinitions.DayOfWeek.ToImmutableDictionary(); MonthOfYear = DateTimeDefinitions.MonthOfYear.ToImmutableDictionary(); Numbers = DateTimeDefinitions.Numbers.ToImmutableDictionary(); DoubleNumbers = DateTimeDefinitions.DoubleNumbers.ToImmutableDictionary(); WrittenDecades = DateTimeDefinitions.WrittenDecades.ToImmutableDictionary(); SpecialDecadeCases = DateTimeDefinitions.SpecialDecadeCases.ToImmutableDictionary(); var numOptions = NumberOptions.None; if ((config.Options & DateTimeOptions.NoProtoCache) != 0) { numOptions = NumberOptions.NoProtoCache; } var numConfig = new BaseNumberOptionsConfiguration(config.Culture, numOptions); CardinalExtractor = Number.Dutch.CardinalExtractor.GetInstance(numConfig); IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(numConfig); OrdinalExtractor = Number.Dutch.OrdinalExtractor.GetInstance(numConfig); NumberParser = new BaseNumberParser(new DutchNumberParserConfiguration(numConfig)); TimeZoneParser = new BaseTimeZoneParser(); DateExtractor = new BaseDateExtractor(new DutchDateExtractorConfiguration(this)); TimeExtractor = new BaseTimeExtractor(new DutchTimeExtractorConfiguration(this)); DateTimeExtractor = new BaseDateTimeExtractor(new DutchDateTimeExtractorConfiguration(this)); DurationExtractor = new BaseDurationExtractor(new DutchDurationExtractorConfiguration(this)); DatePeriodExtractor = new BaseDatePeriodExtractor(new DutchDatePeriodExtractorConfiguration(this)); TimePeriodExtractor = new BaseTimePeriodExtractor(new DutchTimePeriodExtractorConfiguration(this)); DateTimePeriodExtractor = new BaseDateTimePeriodExtractor(new DutchDateTimePeriodExtractorConfiguration(this)); DurationParser = new BaseDurationParser(new DutchDurationParserConfiguration(this)); DateParser = new BaseDateParser(new DutchDateParserConfiguration(this)); TimeParser = new TimeParser(new DutchTimeParserConfiguration(this)); DateTimeParser = new BaseDateTimeParser(new DutchDateTimeParserConfiguration(this)); DatePeriodParser = new BaseDatePeriodParser(new DutchDatePeriodParserConfiguration(this)); TimePeriodParser = new BaseTimePeriodParser(new DutchTimePeriodParserConfiguration(this)); DateTimePeriodParser = new BaseDateTimePeriodParser(new DutchDateTimePeriodParserConfiguration(this)); DateTimeAltParser = new BaseDateTimeAltParser(new DutchDateTimeAltParserConfiguration(this)); }
public DutchDateTimeExtractorConfiguration(IDateTimeOptionsConfiguration config) : base(config) { var numOptions = NumberOptions.None; if ((config.Options & DateTimeOptions.NoProtoCache) != 0) { numOptions = NumberOptions.NoProtoCache; } var numConfig = new BaseNumberOptionsConfiguration(config.Culture, numOptions); IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(numConfig); DatePointExtractor = new BaseDateExtractor(new DutchDateExtractorConfiguration(this)); TimePointExtractor = new BaseTimeExtractor(new DutchTimeExtractorConfiguration(this)); DurationExtractor = new BaseDurationExtractor(new DutchDurationExtractorConfiguration(this)); UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); }
public DutchTimePeriodExtractorConfiguration(IDateTimeOptionsConfiguration config) : base(config) { TokenBeforeDate = DateTimeDefinitions.TokenBeforeDate; SingleTimeExtractor = new BaseTimeExtractor(new DutchTimeExtractorConfiguration(this)); UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); var numOptions = NumberOptions.None; if ((config.Options & DateTimeOptions.NoProtoCache) != 0) { numOptions = NumberOptions.NoProtoCache; } var numConfig = new BaseNumberOptionsConfiguration(config.Culture, numOptions); IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(numConfig); TimeZoneExtractor = new BaseTimeZoneExtractor(new DutchTimeZoneExtractorConfiguration(this)); }
public DutchCommonDateTimeParserConfiguration(IOptionsConfiguration config) : base(config) { UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); UnitMap = DateTimeDefinitions.UnitMap.ToImmutableDictionary(); UnitValueMap = DateTimeDefinitions.UnitValueMap.ToImmutableDictionary(); SeasonMap = DateTimeDefinitions.SeasonMap.ToImmutableDictionary(); CardinalMap = DateTimeDefinitions.CardinalMap.ToImmutableDictionary(); DayOfWeek = DateTimeDefinitions.DayOfWeek.ToImmutableDictionary(); MonthOfYear = DateTimeDefinitions.MonthOfYear.ToImmutableDictionary(); Numbers = DateTimeDefinitions.Numbers.ToImmutableDictionary(); DoubleNumbers = DateTimeDefinitions.DoubleNumbers.ToImmutableDictionary(); WrittenDecades = DateTimeDefinitions.WrittenDecades.ToImmutableDictionary(); SpecialDecadeCases = DateTimeDefinitions.SpecialDecadeCases.ToImmutableDictionary(); CardinalExtractor = Number.Dutch.CardinalExtractor.GetInstance(); IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(); OrdinalExtractor = Number.Dutch.OrdinalExtractor.GetInstance(); TimeZoneParser = new BaseTimeZoneParser(); NumberParser = new BaseNumberParser(new DutchNumberParserConfiguration()); DateExtractor = new BaseDateExtractor(new DutchDateExtractorConfiguration(this)); TimeExtractor = new BaseTimeExtractor(new DutchTimeExtractorConfiguration(this)); DateTimeExtractor = new BaseDateTimeExtractor(new DutchDateTimeExtractorConfiguration(this)); DurationExtractor = new BaseDurationExtractor(new DutchDurationExtractorConfiguration(this)); DatePeriodExtractor = new BaseDatePeriodExtractor(new DutchDatePeriodExtractorConfiguration(this)); TimePeriodExtractor = new BaseTimePeriodExtractor(new DutchTimePeriodExtractorConfiguration(this)); DateTimePeriodExtractor = new BaseDateTimePeriodExtractor(new DutchDateTimePeriodExtractorConfiguration(this)); DurationParser = new BaseDurationParser(new DutchDurationParserConfiguration(this)); DateParser = new BaseDateParser(new DutchDateParserConfiguration(this)); TimeParser = new TimeParser(new DutchTimeParserConfiguration(this)); DateTimeParser = new BaseDateTimeParser(new DutchDateTimeParserConfiguration(this)); DatePeriodParser = new BaseDatePeriodParser(new DutchDatePeriodParserConfiguration(this)); TimePeriodParser = new BaseTimePeriodParser(new DutchTimePeriodParserConfiguration(this)); DateTimePeriodParser = new BaseDateTimePeriodParser(new DutchDateTimePeriodParserConfiguration(this)); DateTimeAltParser = new BaseDateTimeAltParser(new DutchDateTimeAltParserConfiguration(this)); }
public DutchDateExtractorConfiguration(IDateTimeOptionsConfiguration config) : base(config) { var numOptions = NumberOptions.None; if ((config.Options & DateTimeOptions.NoProtoCache) != 0) { numOptions = NumberOptions.NoProtoCache; } var numConfig = new BaseNumberOptionsConfiguration(config.Culture, numOptions); IntegerExtractor = Number.Dutch.IntegerExtractor.GetInstance(numConfig); OrdinalExtractor = Number.Dutch.OrdinalExtractor.GetInstance(numConfig); NumberParser = new BaseNumberParser(new DutchNumberParserConfiguration(numConfig)); DurationExtractor = new BaseDurationExtractor(new DutchDurationExtractorConfiguration(this)); HolidayExtractor = new BaseHolidayExtractor(new DutchHolidayExtractorConfiguration(this)); UtilityConfiguration = new DutchDatetimeUtilityConfiguration(); ImplicitDateList = new List <Regex> { // extract "12" from "on 12" OnRegex, // extract "12th" from "on/at/in 12th" RelaxedOnRegex, // "the day before yesterday", "previous day", "today", "yesterday", "tomorrow" SpecialDayRegex, // "this Monday", "Tuesday of this week" ThisRegex, // "last/previous Monday", "Monday of last week" LastDateRegex, // "next/following Monday", "Monday of next week" NextDateRegex, // "Sunday", "Weds" SingleWeekDayRegex, // "2nd Monday of April" WeekDayOfMonthRegex, // "on the 12th" SpecialDate, // "two days from today", "five days from tomorrow" SpecialDayWithNumRegex, // "three Monday from now" RelativeWeekDayRegex, }; if ((Options & DateTimeOptions.CalendarMode) != 0) { ImplicitDateList = ImplicitDateList.Concat(new[] { DayRegex }); } // 3-23-2017 var dateRegex4 = new Regex(DateTimeDefinitions.DateExtractor4, RegexFlags); // 23-3-2015 var dateRegex5 = new Regex(DateTimeDefinitions.DateExtractor5, RegexFlags); // on (Sunday,)? 1.3 var dateRegex6 = new Regex(DateTimeDefinitions.DateExtractor6, RegexFlags); // on (Sunday,)? 24-12 var dateRegex8 = new Regex(DateTimeDefinitions.DateExtractor8, RegexFlags); // "(Sunday,)? 7/23, 2018", year part is required var dateRegex7L = new Regex(DateTimeDefinitions.DateExtractor7L, RegexFlags); // "(Sunday,)? 7/23", year part is not required var dateRegex7S = new Regex(DateTimeDefinitions.DateExtractor7S, RegexFlags); // "(Sunday,)? 23/7, 2018", year part is required var dateRegex9L = new Regex(DateTimeDefinitions.DateExtractor9L, RegexFlags); // "(Sunday,)? 23/7", year part is not required var dateRegex9S = new Regex(DateTimeDefinitions.DateExtractor9S, RegexFlags); // (Sunday,)? 2015-12-23 var dateRegexA = new Regex(DateTimeDefinitions.DateExtractorA, RegexFlags); DateRegexList = new List <Regex> { // (Sunday,)? April 5 or (Sunday,)? April 5, 2016 new Regex(DateTimeDefinitions.DateExtractor1, RegexFlags), // (Sunday,)? 6th of April new Regex(DateTimeDefinitions.DateExtractor3, RegexFlags), }; var enableDmy = DmyDateFormat || DateTimeDefinitions.DefaultLanguageFallback == Constants.DefaultLanguageFallback_DMY; DateRegexList = DateRegexList.Concat(enableDmy ? new[] { dateRegex5, dateRegex8, dateRegex9L, dateRegex9S, dateRegex4, dateRegex6, dateRegex7L, dateRegex7S, dateRegexA } : new[] { dateRegex4, dateRegex6, dateRegex7L, dateRegex7S, dateRegex5, dateRegex8, dateRegex9L, dateRegex9S, dateRegexA }); }