def __init__(self): super().__init__() self._check_both_before_after = EnglishDateTime.CheckBothBeforeAfter self._simple_cases_regex: List[Pattern] = [ RegExpUtility.get_safe_reg_exp(EnglishDateTime.PureNumFromTo), RegExpUtility.get_safe_reg_exp(EnglishDateTime.PureNumBetweenAnd), RegExpUtility.get_safe_reg_exp(EnglishDateTime.SpecificTimeFromTo), RegExpUtility.get_safe_reg_exp( EnglishDateTime.SpecificTimeBetweenAnd) ] self._till_regex: Pattern = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TillRegex) self._time_of_day_regex: Pattern = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TimeOfDayRegex) self._general_ending_regex: Pattern = RegExpUtility.get_safe_reg_exp( EnglishDateTime.GeneralEndingRegex) self._single_time_extractor = BaseTimeExtractor( EnglishTimeExtractorConfiguration()) self._integer_extractor = EnglishIntegerExtractor() self._time_zone_extractor = BaseTimeZoneExtractor( EnglishTimeZoneExtractorConfiguration()) self._token_before_date = EnglishDateTime.TokenBeforeDate self._pure_number_regex = [ EnglishDateTime.PureNumFromTo, EnglishDateTime.PureNumFromTo ] self._options = DateTimeOptions.NONE
def __init__(self): self._simple_cases_regexes = [ RegExpUtility.get_safe_reg_exp(EnglishDateTime.SimpleCasesRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.BetweenRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.OneWordPeriodRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.MonthWithYear), RegExpUtility.get_safe_reg_exp(EnglishDateTime.MonthNumWithYear), RegExpUtility.get_safe_reg_exp(EnglishDateTime.YearRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.WeekOfMonthRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.WeekOfYearRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthFrontBetweenRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthFrontSimpleCasesRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.QuarterRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.QuarterRegexYearFront), RegExpUtility.get_safe_reg_exp(EnglishDateTime.AllHalfYearRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.SeasonRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.WhichWeekRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.RestOfDateRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.LaterEarlyPeriodRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.WeekWithWeekDayRangeRegex) ] self._illegal_year_regex = RegExpUtility.get_safe_reg_exp( BaseDateTime.IllegalYearRegex) self._year_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.YearRegex) self._till_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TillRegex) self._followed_unit = RegExpUtility.get_safe_reg_exp( EnglishDateTime.FollowedDateUnit) self._number_combined_with_unit = RegExpUtility.get_safe_reg_exp( EnglishDateTime.NumberCombinedWithDateUnit) self._past_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.PastPrefixRegex) self._future_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.NextPrefixRegex) self._week_of_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.WeekOfRegex) self._month_of_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthOfRegex) self._date_unit_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.DateUnitRegex) self._in_connector_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.InConnectorRegex) self._range_unit_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.RangeUnitRegex) self._date_point_extractor = BaseDateExtractor( EnglishDateExtractorConfiguration()) self._integer_extractor = EnglishIntegerExtractor() self._number_parser = BaseNumberParser( EnglishNumberParserConfiguration()) self._duration_extractor = BaseDurationExtractor( EnglishDurationExtractorConfiguration()) self._range_connector_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.RangeConnectorRegex)
def __init__(self): BaseDateParserConfiguration.__init__(self) self._utility_configuration = EnglishDateTimeUtilityConfiguration() self._unit_map = EnglishDateTime.UnitMap self._unit_value_map = EnglishDateTime.UnitValueMap self._season_map = EnglishDateTime.SeasonMap self._cardinal_map = EnglishDateTime.CardinalMap self._day_of_week = EnglishDateTime.DayOfWeek self._month_of_year = EnglishDateTime.MonthOfYear self._numbers = EnglishDateTime.Numbers self._double_numbers = EnglishDateTime.DoubleNumbers self._cardinal_extractor = EnglishCardinalExtractor() self._integer_extractor = EnglishIntegerExtractor() self._ordinal_extractor = EnglishOrdinalExtractor() self._check_both_before_after = EnglishDateTime.CheckBothBeforeAfter self._day_of_month = { **BaseDateTime.DayOfMonthDictionary, **EnglishDateTime.DayOfMonth } self._time_zone_parser = BaseTimeZoneParser() self._number_parser = BaseNumberParser( EnglishNumberParserConfiguration()) self._date_extractor = BaseDateExtractor( EnglishDateExtractorConfiguration()) self._time_extractor = BaseTimeExtractor( EnglishTimeExtractorConfiguration()) self._duration_extractor = BaseDurationExtractor( EnglishDurationExtractorConfiguration()) self._date_period_extractor = BaseDatePeriodExtractor( EnglishDatePeriodExtractorConfiguration()) self._time_period_extractor = BaseTimePeriodExtractor( EnglishTimePeriodExtractorConfiguration()) self._date_time_extractor = BaseDateTimeExtractor( EnglishDateTimeExtractorConfiguration()) self._date_time_period_extractor = BaseDateTimePeriodExtractor( EnglishDateTimePeriodExtractorConfiguration()) self._duration_parser = BaseDurationParser( EnglishDurationParserConfiguration(self)) self._date_parser = BaseDateParser( EnglishDateParserConfiguration(self)) self._time_parser = EnglishTimeParser( EnglishTimeParserConfiguration(self)) self._date_period_parser = BaseDatePeriodParser( EnglishDatePeriodParserConfiguration(self)) self._time_period_parser = BaseTimePeriodParser( EnglishTimePeriodParserConfiguration(self)) self._date_time_parser = BaseDateTimeParser( EnglishDateTimeParserConfiguration(self)) self._date_time_period_parser = BaseDateTimePeriodParser( EnglishDateTimePeriodParserConfiguration(self))
def __init__(self, config: BaseDateParserConfiguration): self._time_extractor = config.time_extractor self._time_parser = config.time_parser self._integer_extractor = EnglishIntegerExtractor() self._pure_number_from_to_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.PureNumFromTo) self._pure_number_between_and_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.PureNumBetweenAnd) self._time_of_day_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TimeOfDayRegex) self._till_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TillRegex) self._numbers = EnglishDateTime.Numbers self._utility_configuration = config.utility_configuration
def __init__(self): self._simple_cases_regex: List[Pattern] = [ RegExpUtility.get_safe_reg_exp(EnglishDateTime.PureNumFromTo), RegExpUtility.get_safe_reg_exp(EnglishDateTime.PureNumBetweenAnd) ] self._till_regex: Pattern = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TillRegex) self._time_of_day_regex: Pattern = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TimeOfDayRegex) self._general_ending_regex: Pattern = RegExpUtility.get_safe_reg_exp( EnglishDateTime.GeneralEndingRegex) self._single_time_extractor = BaseTimeExtractor( EnglishTimeExtractorConfiguration()) self._integer_extractor = EnglishIntegerExtractor()
def __init__(self): self._simple_cases_regexes = [ RegExpUtility.get_safe_reg_exp(EnglishDateTime.SimpleCasesRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.BetweenRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.OneWordPeriodRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.MonthWithYear), RegExpUtility.get_safe_reg_exp(EnglishDateTime.MonthNumWithYear), RegExpUtility.get_safe_reg_exp(EnglishDateTime.YearRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.WeekOfMonthRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.WeekOfYearRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthFrontBetweenRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthFrontSimpleCasesRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.QuarterRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.QuarterRegexYearFront), RegExpUtility.get_safe_reg_exp(EnglishDateTime.AllHalfYearRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.SeasonRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.WhichWeekRegex), RegExpUtility.get_safe_reg_exp(EnglishDateTime.RestOfDateRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.LaterEarlyPeriodRegex), RegExpUtility.get_safe_reg_exp( EnglishDateTime.WeekWithWeekDayRangeRegex) ] self._illegal_year_regex = RegExpUtility.get_safe_reg_exp( BaseDateTime.IllegalYearRegex) self._year_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.YearRegex) self._till_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TillRegex) self._followed_unit = RegExpUtility.get_safe_reg_exp( EnglishDateTime.FollowedDateUnit) self._number_combined_with_unit = RegExpUtility.get_safe_reg_exp( EnglishDateTime.NumberCombinedWithDateUnit) self._past_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.PreviousPrefixRegex) self._future_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.NextPrefixRegex) self._week_of_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.WeekOfRegex) self._month_of_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthOfRegex) self._date_unit_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.DateUnitRegex) self._in_connector_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.InConnectorRegex) self._range_unit_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.RangeUnitRegex) self._date_point_extractor = BaseDateExtractor( EnglishDateExtractorConfiguration()) self._integer_extractor = EnglishIntegerExtractor() self._number_parser = BaseNumberParser( EnglishNumberParserConfiguration()) self._duration_extractor = BaseDurationExtractor( EnglishDurationExtractorConfiguration()) self._range_connector_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.RangeConnectorRegex) self._now_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.NowRegex) self._within_next_prefix_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.WithinNextPrefixRegex) self._time_unit_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.TimeUnitRegex) self._future_suffix_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.FutureSuffixRegex) self._ago_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.AgoRegex) self._later_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.LaterRegex) self._less_than_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.LessThanRegex) self._more_than_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.MoreThanRegex) self._duration_date_restrictions = EnglishDateTime.DurationDateRestrictions self._year_period_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.YearPeriodRegex) self._month_num_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.MonthNumRegex) self._century_suffix_regex = RegExpUtility.get_safe_reg_exp( EnglishDateTime.CenturySuffixRegex) self._ordinal_extractor = EnglishOrdinalExtractor() # TODO When the implementation for these properties is added, change the None values to their respective Regexps self._cardinal_extractor = EnglishCardinalExtractor()