def __init__(self): super().__init__() self._utility_configuration = FrenchDateTimeUtilityConfiguration() self._unit_map = FrenchDateTime.UnitMap self._unit_value_map = FrenchDateTime.UnitValueMap self._season_map = FrenchDateTime.SeasonMap self._cardinal_map = FrenchDateTime.CardinalMap self._day_of_week = FrenchDateTime.DayOfWeek self._month_of_year = FrenchDateTime.MonthOfYear self._numbers = FrenchDateTime.Numbers self._double_numbers = FrenchDateTime.DoubleNumbers self._cardinal_extractor = FrenchCardinalExtractor() self._integer_extractor = FrenchIntegerExtractor() self._ordinal_extractor = FrenchOrdinalExtractor() self._day_of_month = {**BaseDateTime.DayOfMonthDictionary, **FrenchDateTime.DayOfMonth} self._number_parser = BaseNumberParser(FrenchNumberParserConfiguration()) self._date_extractor = BaseDateExtractor(FrenchDateExtractorConfiguration()) self._time_extractor = BaseTimeExtractor(FrenchTimeExtractorConfiguration()) self._duration_extractor = BaseDurationExtractor(FrenchDurationExtractorConfiguration()) self._date_period_extractor = BaseDatePeriodExtractor(FrenchDatePeriodExtractorConfiguration()) self._time_period_extractor = BaseTimePeriodExtractor(FrenchTimePeriodExtractorConfiguration()) self._date_time_extractor = BaseDateTimeExtractor(FrenchDateTimeExtractorConfiguration()) self._date_time_period_extractor = BaseDateTimePeriodExtractor(FrenchDateTimePeriodExtractorConfiguration()) self._duration_parser = BaseDurationParser(FrenchDurationParserConfiguration(self)) self._date_parser = BaseDateParser(FrenchDateParserConfiguration(self)) self._time_parser = FrenchTimeParser(FrenchTimeParserConfiguration(self)) self._date_period_parser = BaseDatePeriodParser(FrenchDatePeriodParserConfiguration(self)) self._time_period_parser = BaseTimePeriodParser(FrenchTimePeriodParserConfiguration(self)) self._date_time_parser = BaseDateTimeParser(FrenchDateTimeParserConfiguration(self)) self._date_time_period_parser = BaseDateTimePeriodParser(FrenchDateTimePeriodParserConfiguration(self))
def __init__(self): if FrenchDateTime.DefaultLanguageFallback == Constants.DEFAULT_LANGUAGE_FALLBACK_DMY: date_extractor_4 = FrenchDateTime.DateExtractor5 date_extractor_5 = FrenchDateTime.DateExtractor4 else: date_extractor_4 = FrenchDateTime.DateExtractor4 date_extractor_5 = FrenchDateTime.DateExtractor5 self._date_regex_list = [ RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor1), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor2), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor3), RegExpUtility.get_safe_reg_exp(date_extractor_4), RegExpUtility.get_safe_reg_exp(date_extractor_5), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor6), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor7), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor8), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor9), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractorA), ] self._implicit_date_list = [ RegExpUtility.get_safe_reg_exp(FrenchDateTime.OnRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.RelaxedOnRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.SpecialDayRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.ThisRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.LastDateRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.NextDateRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.StrictWeekDay), RegExpUtility.get_safe_reg_exp(FrenchDateTime.WeekDayOfMonthRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.SpecialDate), ] self._month_end = RegExpUtility.get_safe_reg_exp( FrenchDateTime.MonthEnd) self._of_month = RegExpUtility.get_safe_reg_exp(FrenchDateTime.OfMonth) self._date_unit_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.DateUnitRegex) self._for_the_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.ForTheRegex) self._week_day_and_day_of_month_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayAndDayOfMonthRegex) self._relative_month_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.RelativeMonthRegex) self._week_day_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayRegex) self._day_of_week = FrenchDateTime.DayOfWeek self._ordinal_extractor = FrenchOrdinalExtractor() self._integer_extractor = FrenchIntegerExtractor() self._number_parser = BaseNumberParser( FrenchNumberParserConfiguration()) self._duration_extractor = BaseDurationExtractor( FrenchDurationExtractorConfiguration()) self._utility_configuration = FrenchDateTimeUtilityConfiguration()
def __init__(self): self._before_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.BeforeRegex) self._after_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.AfterRegex) self._since_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.SinceRegex) self._from_to_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.FromToRegex) self._single_ambiguous_month_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.SingleAmbiguousMonthRegex) self._preposition_suffix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.PrepositionSuffixRegex) self._ambiguous_range_modifier_prefix = RegExpUtility.get_safe_reg_exp( FrenchDateTime.AmbiguousRangeModifierPrefix) self._number_ending_pattern = RegExpUtility.get_safe_reg_exp( FrenchDateTime.NumberEndingPattern) self._date_extractor = BaseDateExtractor( FrenchDateExtractorConfiguration()) self._time_extractor = BaseTimeExtractor( FrenchTimeExtractorConfiguration()) self._date_time_extractor = BaseDateTimeExtractor( FrenchDateTimeExtractorConfiguration()) self._date_period_extractor = BaseDatePeriodExtractor( FrenchDatePeriodExtractorConfiguration()) self._time_period_extractor = BaseTimePeriodExtractor( FrenchTimePeriodExtractorConfiguration()) self._date_time_period_extractor = BaseDateTimePeriodExtractor( FrenchDateTimePeriodExtractorConfiguration()) self._duration_extractor = BaseDurationExtractor( FrenchDurationExtractorConfiguration()) self._set_extractor = BaseSetExtractor( FrenchSetExtractorConfiguration()) self._holiday_extractor = BaseHolidayExtractor( FrenchHolidayExtractorConfiguration()) self._integer_extractor = FrenchIntegerExtractor() self._filter_word_regex_list = [] self._unspecified_date_period_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.UnspecificDatePeriodRegex) self._around_regex = FrenchDateTime.AroundRegex self._equal_regex = BaseDateTime.EqualRegex self._suffix_after_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.SuffixAfterRegex) self._check_both_before_after = FrenchDateTime.CheckBothBeforeAfter # TODO When the implementation for these properties is added, change the None values to their respective Regexps self._superfluous_word_matcher = None self._fail_fast_regex = None self._term_filter_regexes = None self._datetime_alt_extractor = None self._time_zone_extractor = None self._ambiguity_filters_dict = DefinitionLoader.load_ambiguity_filters( FrenchDateTime.AmbiguityFiltersDict)
def __init__(self): self._before_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.BeforeRegex) self._after_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.AfterRegex) self._since_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.SinceRegex) self._from_to_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.FromToRegex) self._single_ambiguous_month_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.SingleAmbiguousMonthRegex) self._preposition_suffix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.PrepositionSuffixRegex) self._ambiguous_range_modifier_prefix = RegExpUtility.get_safe_reg_exp( FrenchDateTime.AmbiguousRangeModifierPrefix) self._number_ending_pattern = RegExpUtility.get_safe_reg_exp( FrenchDateTime.NumberEndingPattern) self._date_extractor = BaseDateExtractor( FrenchDateExtractorConfiguration()) self._time_extractor = BaseTimeExtractor( FrenchTimeExtractorConfiguration()) self._date_time_extractor = BaseDateTimeExtractor( FrenchDateTimeExtractorConfiguration()) self._date_period_extractor = BaseDatePeriodExtractor( FrenchDatePeriodExtractorConfiguration()) self._time_period_extractor = BaseTimePeriodExtractor( FrenchTimePeriodExtractorConfiguration()) self._date_time_period_extractor = BaseDateTimePeriodExtractor( FrenchDateTimePeriodExtractorConfiguration()) self._duration_extractor = BaseDurationExtractor( FrenchDurationExtractorConfiguration()) self._set_extractor = BaseSetExtractor( FrenchSetExtractorConfiguration()) self._holiday_extractor = BaseHolidayExtractor( FrenchHolidayExtractorConfiguration()) self._integer_extractor = FrenchIntegerExtractor() self._filter_word_regex_list = []
def __init__(self): self._check_both_before_after = False if FrenchDateTime.DefaultLanguageFallback == Constants.DEFAULT_LANGUAGE_FALLBACK_DMY: date_extractor_4 = FrenchDateTime.DateExtractor5 date_extractor_5 = FrenchDateTime.DateExtractor4 date_extractor_6 = FrenchDateTime.DateExtractor7 date_extractor_7 = FrenchDateTime.DateExtractor6 else: date_extractor_4 = FrenchDateTime.DateExtractor4 date_extractor_5 = FrenchDateTime.DateExtractor5 date_extractor_6 = FrenchDateTime.DateExtractor6 date_extractor_7 = FrenchDateTime.DateExtractor7 self._date_regex_list = [ RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor1), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor2), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor3), RegExpUtility.get_safe_reg_exp(date_extractor_4), RegExpUtility.get_safe_reg_exp(date_extractor_5), RegExpUtility.get_safe_reg_exp(date_extractor_6), RegExpUtility.get_safe_reg_exp(date_extractor_7), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor8), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractor9), RegExpUtility.get_safe_reg_exp(FrenchDateTime.DateExtractorA), ] self._implicit_date_list = [ RegExpUtility.get_safe_reg_exp(FrenchDateTime.OnRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.RelaxedOnRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.SpecialDayRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.ThisRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.LastDateRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.NextDateRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.StrictWeekDay), RegExpUtility.get_safe_reg_exp(FrenchDateTime.WeekDayOfMonthRegex), RegExpUtility.get_safe_reg_exp(FrenchDateTime.SpecialDate), ] self._month_end = RegExpUtility.get_safe_reg_exp( FrenchDateTime.MonthEnd) self._of_month = RegExpUtility.get_safe_reg_exp(FrenchDateTime.OfMonth) self._date_unit_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.DateUnitRegex) self._for_the_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.ForTheRegex) self._week_day_and_day_of_month_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayAndDayOfMonthRegex) self._relative_month_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.RelativeMonthRegex) self._week_day_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayRegex) self._day_of_week = FrenchDateTime.DayOfWeek self._ordinal_extractor = FrenchOrdinalExtractor() self._integer_extractor = FrenchIntegerExtractor() self._number_parser = BaseNumberParser( FrenchNumberParserConfiguration()) self._duration_extractor = BaseDurationExtractor( FrenchDurationExtractorConfiguration()) self._utility_configuration = FrenchDateTimeUtilityConfiguration() self._range_connector_symbol_regex = RegExpUtility.get_safe_reg_exp( BaseDateTime.RangeConnectorSymbolRegex) self._strict_relative_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.StrictRelativeRegex) self._year_suffix = RegExpUtility.get_safe_reg_exp( FrenchDateTime.YearSuffix) self._month_of_year = FrenchDateTime.MonthOfYear self._prefix_article_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.PrefixArticleRegex) self._week_day_end = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayEnd) self._more_than_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.MoreThanRegex) self._less_than_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.LessThanRegex) self._in_connector_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.InConnectorRegex) self._range_unit_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.RangeUnitRegex) self._since_year_suffix_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.SinceYearSuffixRegex) self._week_day_and_day_regex = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayAndDayRegex) self._week_day_start = RegExpUtility.get_safe_reg_exp( FrenchDateTime.WeekDayStart) self._check_both_before_after = FrenchDateTime.CheckBothBeforeAfter