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): self._year_period_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.YearPeriodRegex) self._previous_prefix_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.PastRegex) self._simple_cases_regexes = [ self._year_period_regex, RegExpUtility.get_safe_reg_exp(SpanishDateTime.SimpleCasesRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.DayBetweenRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.OneWordPeriodRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.MonthWithYearRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.MonthNumWithYearRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.YearRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.WeekOfMonthRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.WeekOfYearRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.MonthFrontBetweenRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.MonthFrontSimpleCasesRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.QuarterRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.QuarterRegexYearFront), RegExpUtility.get_safe_reg_exp(SpanishDateTime.SeasonRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.RestOfDateRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.LaterEarlyPeriodRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.WeekWithWeekDayRangeRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.YearPlusNumberRegex), RegExpUtility.get_safe_reg_exp(SpanishDateTime.WhichWeekRegex), RegExpUtility.get_safe_reg_exp( SpanishDateTime.ReferenceDatePeriodRegex), ] self._check_both_before_after = SpanishDateTime.CheckBothBeforeAfter self._time_unit_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.TimeUnitRegex) self._within_next_prefix_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.WithinNextPrefixRegex) self._illegal_year_regex = RegExpUtility.get_safe_reg_exp( BaseDateTime.IllegalYearRegex) self._year_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.YearRegex) self._till_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.TillRegex) self._followed_unit = RegExpUtility.get_safe_reg_exp( SpanishDateTime.FollowedDateUnit) self._number_combined_with_unit = RegExpUtility.get_safe_reg_exp( SpanishDateTime.NumberCombinedWithDateUnit) self._past_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.PastRegex) self._future_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.FutureRegex) self._week_of_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.WeekOfRegex) self._month_of_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.MonthOfRegex) self._date_unit_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.DateUnitRegex) self._in_connector_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.InConnectorRegex) self._range_unit_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.RangeUnitRegex) self._all_half_year_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.AllHalfYearRegex) self.from_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.FromRegex) self.connector_and_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.ConnectorAndRegex) self.between_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.BetweenRegex) self._date_point_extractor = BaseDateExtractor( SpanishDateExtractorConfiguration()) self._integer_extractor = SpanishIntegerExtractor() self._number_parser = BaseNumberParser( SpanishNumberParserConfiguration()) self._duration_extractor = BaseDurationExtractor( SpanishDurationExtractorConfiguration()) self._now_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.NowRegex) self._future_suffix_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.FutureSuffixRegex) self._ago_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.AgoRegex) self._later_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.LaterRegex) self._less_than_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.LessThanRegex) self._more_than_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.MoreThanRegex) self._duration_date_restrictions = SpanishDateTime.DurationDateRestrictions self._month_num_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.MonthNumRegex) self._century_suffix_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.CenturySuffixRegex) self._check_both_before_after = False self._cardinal_extractor = SpanishCardinalExtractor() self._ordinal_extractor = SpanishOrdinalExtractor() self._decade_with_century_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.DecadeWithCenturyRegex) self._previous_prefix_regex = RegExpUtility.get_safe_reg_exp( SpanishDateTime.PreviousPrefixRegex)
def __init__(self): self._simple_cases_regexes = [ RegExpUtility.get_safe_reg_exp(FrenchDateTime.SimpleCasesRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.BetweenRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.OneWordPeriodRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.MonthWithYear), RegExpUtility.get_safe_reg_exp(FrenchDateTime.MonthNumWithYear), RegExpUtility.get_safe_reg_exp(FrenchDateTime.YearRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.WeekDayOfMonthRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.WeekOfYearRegex), RegExpUtility.get_safe_reg_exp( FrenchDateTime.MonthFrontBetweenRegex), RegExpUtility.get_safe_reg_exp( FrenchDateTime.MonthFrontSimpleCasesRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.QuarterRegex), RegExpUtility.get_safe_reg_exp( FrenchDateTime.QuarterRegexYearFront), RegExpUtility.get_safe_reg_exp(FrenchDateTime.AllHalfYearRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.SeasonRegex), RegExpUtility.get_safe_reg_exp( FrenchDateTime.LaterEarlyPeriodRegex), RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekWithWeekDayRangeRegex) ] self._check_both_before_after = FrenchDateTime.CheckBothBeforeAfter self._illegal_year_regex = RegExpUtility.get_safe_reg_exp( BaseDateTime.IllegalYearRegex) self._year_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.YearRegex) self._till_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.TillRegex) self._followed_unit = RegExpUtility.get_safe_reg_exp( FrenchDateTime.FollowedDateUnit) self._number_combined_with_unit = RegExpUtility.get_safe_reg_exp( FrenchDateTime.NumberCombinedWithDateUnit) self._past_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.PastSuffixRegex) self._future_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.NextSuffixRegex) self._week_of_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekOfRegex) self._month_of_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.MonthOfRegex) self._date_unit_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.DateUnitRegex) self._within_next_prefix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WithinNextPrefixRegex) self._in_connector_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.InConnectorRegex) self._range_unit_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.RangeUnitRegex) self.from_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.FromRegex) self.connector_and_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.ConnectorAndRegex) self.before_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.BeforeRegex2) self._date_point_extractor = BaseDateExtractor( FrenchDateExtractorConfiguration()) self._integer_extractor = FrenchIntegerExtractor() self._number_parser = BaseNumberParser( FrenchNumberParserConfiguration()) self._duration_extractor = BaseDurationExtractor( FrenchDurationExtractorConfiguration()) self._now_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.NowRegex) self._future_suffix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.FutureSuffixRegex ) self._ago_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.AgoRegex ) self._later_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.LaterRegex ) self._less_than_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.LessThanRegex ) self._more_than_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.MoreThanRegex ) self._duration_date_restrictions = FrenchDateTime.DurationDateRestrictions self._year_period_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.YearPeriodRegex ) self._month_num_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.MonthNumRegex ) self._century_suffix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.CenturySuffixRegex ) self._ordinal_extractor = FrenchOrdinalExtractor() self._previous_prefix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.PreviousPrefixRegex ) self._cardinal_extractor = FrenchCardinalExtractor() # TODO When the implementation for these properties is added, change the None values to their respective Regexps self._time_unit_regex = None