def __init__(self):
     super().__init__()
     self._check_both_before_after = FrenchDateTime.CheckBothBeforeAfter
     self._inexact_number_regex = RegExpUtility.get_safe_reg_exp(FrenchDateTime.InexactNumberRegex)
     self._conjunction_regex = RegExpUtility.get_safe_reg_exp(FrenchDateTime.ConjunctionRegex)
     self._all_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.AllRegex)
     self._half_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.HalfRegex)
     self._followed_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.DurationFollowedUnit)
     self._number_combined_with_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.NumberCombinedWithDurationUnit)
     self._an_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.AnUnitRegex)
     self._inexact_number_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.InexactNumberUnitRegex)
     self._suffix_and_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.SuffixAndRegex)
     self._relative_duration_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.RelativeDurationUnitRegex)
     self._more_than_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.MoreThanRegex)
     self._less_than_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.LessThanOneHour)
     self._cardinal_extractor: BaseNumberExtractor = FrenchCardinalExtractor()
     self._during_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.DuringRegex
     )
     self._unit_map = FrenchDateTime.UnitMap
     self._unit_value_map = FrenchDateTime.UnitValueMap
     self._duration_unit_regex = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.DurationUnitRegex
     )
     self._duration_connector_regex = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.DurationConnectorRegex
     )
     self._more_than_regex = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.MoreThanRegex
     )
     self._less_than_regex = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.LessThanRegex
     )
     self._check_both_before_after = FrenchDateTime.CheckBothBeforeAfter
     self._special_number_unit_regex = None
Exemple #2
0
 def __init__(self):
     self._all_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.AllRegex)
     self._half_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.HalfRegex)
     self._followed_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.DurationFollowedUnit)
     self._number_combined_with_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.NumberCombinedWithDurationUnit)
     self._an_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.AnUnitRegex)
     self._inexact_number_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.InexactNumberUnitRegex)
     self._suffix_and_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.SuffixAndRegex)
     self._relative_duration_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.RelativeDurationUnitRegex)
     self._more_than_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.MoreThanRegex)
     self._less_than_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         FrenchDateTime.LessThanOneHour)
     self._cardinal_extractor: BaseNumberExtractor = FrenchCardinalExtractor()
Exemple #3
0
    def __init__(self):
        self._all_half_year_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.AllHalfYearRegex)
        self._week_day_of_month_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.WeekDayOfMonthRegex)
        self._complex_date_period_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.ComplexDatePeriodRegex)
        self._rest_of_date_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.RestOfDateRegex)
        self._which_week_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.WhichWeekRegex)
        self._this_prefix_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.ThisPrefixRegex)
        self._next_prefix_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.NextSuffixRegex)
        self._past_prefix_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.PastSuffixRegex)
        self._month_suffix_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.MonthSuffixRegex)
        self._written_month_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.WrittenMonthRegex)
        self._relative_month_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.RelativeMonthRegex)
        self._week_day_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.WeekDayRegex)
        self._day_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.DayRegex)
        self._range_connector_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.RangeConnectorRegex)
        self._time_unit_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.TimeUnitRegex)
        self._previous_prefix_regex = RegExpUtility.get_safe_reg_exp(
            FrenchDateTime.PastSuffixRegex)
        self._check_both_before_after = FrenchDateTime.CheckBothBeforeAfter
        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.YearPeriodRegex),
            RegExpUtility.get_safe_reg_exp(FrenchDateTime.WeekOfYearRegex),
            RegExpUtility.get_safe_reg_exp(FrenchDateTime.WeekDayOfMonthRegex),
            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.SeasonRegex),
            RegExpUtility.get_safe_reg_exp(
                FrenchDateTime.LaterEarlyPeriodRegex),
            RegExpUtility.get_safe_reg_exp(
                FrenchDateTime.WeekWithWeekDayRangeRegex),
            RegExpUtility.get_safe_reg_exp(FrenchDateTime.YearPlusNumberRegex),
            RegExpUtility.get_safe_reg_exp(
                FrenchDateTime.DecadeWithCenturyRegex),
            RegExpUtility.get_safe_reg_exp(FrenchDateTime.RelativeDecadeRegex)
        ]
        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._cardinal_extractor = FrenchCardinalExtractor()
        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