public GermanTimePeriodExtractorConfiguration(IOptionsConfiguration config) : base(config)
 {
     TokenBeforeDate      = DateTimeDefinitions.TokenBeforeDate;
     SingleTimeExtractor  = new BaseTimeExtractor(new GermanTimeExtractorConfiguration(this));
     UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
     IntegerExtractor     = Number.German.IntegerExtractor.GetInstance();
 }
示例#2
0
        public GermanCommonDateTimeParserConfiguration(DateTimeOptions options) : base(options)
        {
            UtilityConfiguration = new GermanDatetimeUtilityConfiguration();

            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.German.CardinalExtractor.GetInstance();
            IntegerExtractor  = Number.German.IntegerExtractor.GetInstance();
            OrdinalExtractor  = Number.German.OrdinalExtractor.GetInstance();

            NumberParser            = new BaseNumberParser(new GermanNumberParserConfiguration());
            DateExtractor           = new BaseDateExtractor(new GermanDateExtractorConfiguration());
            TimeExtractor           = new BaseTimeExtractor(new GermanTimeExtractorConfiguration());
            DateTimeExtractor       = new BaseDateTimeExtractor(new GermanDateTimeExtractorConfiguration());
            DurationExtractor       = new BaseDurationExtractor(new GermanDurationExtractorConfiguration());
            DatePeriodExtractor     = new BaseDatePeriodExtractor(new GermanDatePeriodExtractorConfiguration());
            TimePeriodExtractor     = new BaseTimePeriodExtractor(new GermanTimePeriodExtractorConfiguration());
            DateTimePeriodExtractor = new BaseDateTimePeriodExtractor(new GermanDateTimePeriodExtractorConfiguration());
            DurationParser          = new BaseDurationParser(new GermanDurationParserConfiguration(this));
            DateParser           = new BaseDateParser(new GermanDateParserConfiguration(this));
            TimeParser           = new TimeParser(new GermanTimeParserConfiguration(this));
            DateTimeParser       = new BaseDateTimeParser(new GermanDateTimeParserConfiguration(this));
            DatePeriodParser     = new BaseDatePeriodParser(new GermanDatePeriodParserConfiguration(this));
            TimePeriodParser     = new BaseTimePeriodParser(new GermanTimePeriodParserConfiguration(this));
            DateTimePeriodParser = new BaseDateTimePeriodParser(new GermanDateTimePeriodParserConfiguration(this));
        }
 public GermanDateTimeExtractorConfiguration() : base(DateTimeOptions.None)
 {
     DatePointExtractor   = new BaseDateExtractor(new GermanDateExtractorConfiguration());
     TimePointExtractor   = new BaseTimeExtractor(new GermanTimeExtractorConfiguration());
     DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration());
     UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
 }
示例#4
0
 public GermanDateTimeExtractorConfiguration(DateTimeOptions options = DateTimeOptions.None) : base(options)
 {
     IntegerExtractor     = Number.German.IntegerExtractor.GetInstance();
     DatePointExtractor   = new BaseDateExtractor(new GermanDateExtractorConfiguration());
     TimePointExtractor   = new BaseTimeExtractor(new GermanTimeExtractorConfiguration());
     DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration());
     UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
 }
 public GermanDateExtractorConfiguration() : base(DateTimeOptions.None)
 {
     IntegerExtractor     = Number.German.IntegerExtractor.GetInstance();
     OrdinalExtractor     = Number.German.OrdinalExtractor.GetInstance();
     NumberParser         = new BaseNumberParser(new GermanNumberParserConfiguration());
     DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration());
     UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
 }
示例#6
0
 public GermanDateTimeExtractorConfiguration(IOptionsConfiguration config) : base(config)
 {
     IntegerExtractor     = Number.German.IntegerExtractor.GetInstance();
     DatePointExtractor   = new BaseDateExtractor(new GermanDateExtractorConfiguration(this));
     TimePointExtractor   = new BaseTimeExtractor(new GermanTimeExtractorConfiguration(this));
     DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration(this));
     UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
 }
示例#7
0
        public GermanDateExtractorConfiguration(IOptionsConfiguration config)
            : base(config)
        {
            IntegerExtractor     = Number.German.IntegerExtractor.GetInstance();
            OrdinalExtractor     = Number.German.OrdinalExtractor.GetInstance();
            NumberParser         = new BaseNumberParser(new GermanNumberParserConfiguration());
            DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration(this));
            UtilityConfiguration = new GermanDatetimeUtilityConfiguration();

            const RegexOptions dateRegexOption = RegexOptions.Singleline;

            // 3-23-2017
            var dateRegex4 = new Regex(DateTimeDefinitions.DateExtractor4, dateRegexOption);

            // 23-3-2015
            var dateRegex5 = new Regex(DateTimeDefinitions.DateExtractor5, dateRegexOption);

            // am 1.3
            var dateRegex6 = new Regex(DateTimeDefinitions.DateExtractor6, dateRegexOption);

            // am 24-12
            var dateRegex8 = new Regex(DateTimeDefinitions.DateExtractor8, dateRegexOption);

            // 7/23
            var dateRegex7 = new Regex(DateTimeDefinitions.DateExtractor7, dateRegexOption);

            // 23/7
            var dateRegex9 = new Regex(DateTimeDefinitions.DateExtractor9, dateRegexOption);

            // Nächstes Jahr (im Sommer)?
            var dateRegex10 = new Regex(DateTimeDefinitions.DateExtractor10, dateRegexOption);

            // 2015-12-23
            var dateRegexA = new Regex(DateTimeDefinitions.DateExtractorA, dateRegexOption);

            DateRegexList = new List <Regex>
            {
                // (Sonntag,)? 5. April
                new Regex(DateTimeDefinitions.DateExtractor1, dateRegexOption),

                // (Sonntag,)? 5. April, 2016
                new Regex(DateTimeDefinitions.DateExtractor2, dateRegexOption),

                // (Sonntag,)? der 6. April, 2016
                new Regex(DateTimeDefinitions.DateExtractor3, dateRegexOption),
            };

            var enableDmy = DmyDateFormat ||
                            DateTimeDefinitions.DefaultLanguageFallback == Constants.DefaultLanguageFallback_DMY;

            DateRegexList = DateRegexList.Concat(enableDmy ?
                                                 new[] { dateRegex5, dateRegex8, dateRegex9, dateRegex4, dateRegex6, dateRegex7, dateRegex10, dateRegexA } :
                                                 new[] { dateRegex4, dateRegex6, dateRegex7, dateRegex5, dateRegex8, dateRegex9, dateRegex10, dateRegexA });
        }
        public GermanCommonDateTimeParserConfiguration(IDateTimeOptionsConfiguration config)
            : base(config)
        {
            UtilityConfiguration = new GermanDatetimeUtilityConfiguration();

            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.German.CardinalExtractor.GetInstance(numConfig);
            IntegerExtractor  = Number.German.IntegerExtractor.GetInstance(numConfig);
            OrdinalExtractor  = Number.German.OrdinalExtractor.GetInstance(numConfig);

            NumberParser = new BaseNumberParser(new GermanNumberParserConfiguration(numConfig));

            DateExtractor           = new BaseDateExtractor(new GermanDateExtractorConfiguration(this));
            TimeExtractor           = new BaseTimeExtractor(new GermanTimeExtractorConfiguration(this));
            DateTimeExtractor       = new BaseDateTimeExtractor(new GermanDateTimeExtractorConfiguration(this));
            DurationExtractor       = new BaseDurationExtractor(new GermanDurationExtractorConfiguration(this));
            DatePeriodExtractor     = new BaseDatePeriodExtractor(new GermanDatePeriodExtractorConfiguration(this));
            TimePeriodExtractor     = new BaseTimePeriodExtractor(new GermanTimePeriodExtractorConfiguration(this));
            DateTimePeriodExtractor = new BaseDateTimePeriodExtractor(new GermanDateTimePeriodExtractorConfiguration(this));
            DurationParser          = new BaseDurationParser(new GermanDurationParserConfiguration(this));
            DateParser           = new BaseDateParser(new GermanDateParserConfiguration(this));
            TimeParser           = new TimeParser(new GermanTimeParserConfiguration(this));
            DateTimeParser       = new BaseDateTimeParser(new GermanDateTimeParserConfiguration(this));
            DatePeriodParser     = new BaseDatePeriodParser(new GermanDatePeriodParserConfiguration(this));
            TimePeriodParser     = new BaseTimePeriodParser(new GermanTimePeriodParserConfiguration(this));
            DateTimePeriodParser = new BaseDateTimePeriodParser(new GermanDateTimePeriodParserConfiguration(this));
        }
        public GermanDateTimeExtractorConfiguration(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.German.IntegerExtractor.GetInstance(numConfig);

            DatePointExtractor   = new BaseDateExtractor(new GermanDateExtractorConfiguration(this));
            TimePointExtractor   = new BaseTimeExtractor(new GermanTimeExtractorConfiguration(this));
            DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration(this));
            UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
        }
        public GermanTimePeriodExtractorConfiguration(IDateTimeOptionsConfiguration config)
            : base(config)
        {
            TokenBeforeDate      = DateTimeDefinitions.TokenBeforeDate;
            SingleTimeExtractor  = new BaseTimeExtractor(new GermanTimeExtractorConfiguration(this));
            UtilityConfiguration = new GermanDatetimeUtilityConfiguration();

            var numOptions = NumberOptions.None;

            if ((config.Options & DateTimeOptions.NoProtoCache) != 0)
            {
                numOptions = NumberOptions.NoProtoCache;
            }

            var numConfig = new BaseNumberOptionsConfiguration(config.Culture, numOptions);

            IntegerExtractor = Number.German.IntegerExtractor.GetInstance(numConfig);

            TimeZoneExtractor = new BaseTimeZoneExtractor(new GermanTimeZoneExtractorConfiguration(this));
        }
示例#11
0
        public GermanDateExtractorConfiguration(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.German.IntegerExtractor.GetInstance(numConfig);
            OrdinalExtractor = Number.German.OrdinalExtractor.GetInstance(numConfig);
            NumberParser     = new BaseNumberParser(new GermanNumberParserConfiguration(new BaseNumberOptionsConfiguration(numConfig)));

            DurationExtractor    = new BaseDurationExtractor(new GermanDurationExtractorConfiguration(this));
            HolidayExtractor     = new BaseHolidayExtractor(new GermanHolidayExtractorConfiguration(this));
            UtilityConfiguration = new GermanDatetimeUtilityConfiguration();

            // 3-23-2017
            var dateRegex4 = new Regex(DateTimeDefinitions.DateExtractor4, RegexFlags);

            // 23-3-2015
            var dateRegex5 = new Regex(DateTimeDefinitions.DateExtractor5, RegexFlags);

            // am 1.3
            var dateRegex6 = new Regex(DateTimeDefinitions.DateExtractor6, RegexFlags);

            // am 24-12
            var dateRegex8 = new Regex(DateTimeDefinitions.DateExtractor8, RegexFlags);

            // 7/23
            var dateRegex7 = new Regex(DateTimeDefinitions.DateExtractor7, RegexFlags);

            // 23/7
            var dateRegex9 = new Regex(DateTimeDefinitions.DateExtractor9, RegexFlags);

            // Nächstes Jahr (im Sommer)?
            var dateRegex10 = new Regex(DateTimeDefinitions.DateExtractor10, RegexFlags);

            // 2015-12-23
            var dateRegexA = new Regex(DateTimeDefinitions.DateExtractorA, RegexFlags);

            DateRegexList = new List <Regex>
            {
                // (Sonntag,)? 5. April
                new Regex(DateTimeDefinitions.DateExtractor1, RegexFlags),

                // (Sonntag,)? 5. April, 2016
                new Regex(DateTimeDefinitions.DateExtractor2, RegexFlags),

                // (Sonntag,)? der 6. April, 2016
                new Regex(DateTimeDefinitions.DateExtractor3, RegexFlags),
            };

            var enableDmy = DmyDateFormat ||
                            DateTimeDefinitions.DefaultLanguageFallback == Constants.DefaultLanguageFallback_DMY;

            DateRegexList = DateRegexList.Concat(enableDmy ?
                                                 new[] { dateRegex5, dateRegex8, dateRegex9, dateRegex4, dateRegex6, dateRegex7, dateRegex10, dateRegexA } :
                                                 new[] { dateRegex4, dateRegex6, dateRegex7, dateRegex5, dateRegex8, dateRegex9, dateRegex10, dateRegexA });
        }
 public GermanTimePeriodExtractorConfiguration() : base(DateTimeOptions.None)
 {
     SingleTimeExtractor  = new BaseTimeExtractor(new GermanTimeExtractorConfiguration());
     UtilityConfiguration = new GermanDatetimeUtilityConfiguration();
     IntegerExtractor     = Number.German.IntegerExtractor.GetInstance();
 }