Ejemplo n.º 1
0
 def __init__(self):
     super().__init__()
     self._all_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.AllRegex)
     self._half_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.HalfRegex)
     self._followed_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DurationFollowedUnit)
     self._number_combined_with_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.NumberCombinedWithDurationUnit)
     self._an_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.AnUnitRegex)
     self._inexact_number_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.InexactNumberUnitRegex)
     self._suffix_and_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.SuffixAndRegex)
     self._relative_duration_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.RelativeDurationUnitRegex)
     self._during_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DuringRegex)
     self._cardinal_extractor: BaseNumberExtractor = EnglishCardinalExtractor(
     )
     self._unit_map = EnglishDateTime.UnitMap
     self._unit_value_map = EnglishDateTime.UnitValueMap
     self._duration_unit_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DurationUnitRegex)
     self._duration_connector_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DurationConnectorRegex)
     self._more_than_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.MoreThanRegex)
     self._less_than_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.LessThanRegex)
 def __init__(self):
     self._all_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.AllRegex)
     self._half_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.HalfRegex)
     self._followed_unit: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.DurationFollowedUnit)
     self._number_combined_with_unit: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.NumberCombinedWithDurationUnit)
     self._an_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.AnUnitRegex)
     self._inexact_number_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.InexactNumberUnitRegex)
     self._suffix_and_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.SuffixAndRegex)
     self._relative_duration_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.RelativeDurationUnitRegex)
     self._cardinal_extractor: BaseNumberExtractor = EnglishCardinalExtractor()
 def __init__(self, config):
     self._cardinal_extractor: BaseNumberExtractor = EnglishCardinalExtractor()
     self._number_parser: BaseNumberParser = BaseNumberParser(EnglishNumberParserConfiguration())
     self._followed_unit: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.DurationFollowedUnit)
     self._suffix_and_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.SuffixAndRegex)
     self._number_combined_with_unit: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.NumberCombinedWithDurationUnit)
     self._an_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.AnUnitRegex)
     self._all_date_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.AllRegex)
     self._half_date_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.HalfRegex)
     self._inexact_number_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(EnglishDateTime.InexactNumberUnitRegex)
     self._unit_map: Dict[str, int] = EnglishDateTime.UnitMap
     self._unit_value_map: Dict[str, int] = EnglishDateTime.UnitValueMap
     self._double_numbers: Dict[str, float] = EnglishDateTime.DoubleNumbers
Ejemplo n.º 4
0
    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))
Ejemplo n.º 5
0
 def __init__(self):
     super().__init__()
     self._check_both_before_after = EnglishDateTime.CheckBothBeforeAfter
     self._all_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.AllRegex)
     self._half_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.HalfRegex)
     self._followed_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DurationFollowedUnit)
     self._number_combined_with_unit: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.NumberCombinedWithDurationUnit)
     self._an_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.AnUnitRegex)
     self._inexact_number_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.InexactNumberUnitRegex)
     self._suffix_and_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.SuffixAndRegex)
     self._relative_duration_unit_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.RelativeDurationUnitRegex
     )
     self._during_regex: Pattern = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DuringRegex
     )
     self._cardinal_extractor: BaseNumberExtractor = EnglishCardinalExtractor()
     self._unit_map = EnglishDateTime.UnitMap
     self._unit_value_map = EnglishDateTime.UnitValueMap
     self._duration_unit_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DurationUnitRegex
     )
     self._duration_connector_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.DurationConnectorRegex
     )
     self._more_than_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.MoreThanRegex
     )
     self._less_than_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.LessThanRegex
     )
     self._conjunction_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.ConjunctionRegex
     )
     self._inexact_number_regex = RegExpUtility.get_safe_reg_exp(
         EnglishDateTime.InexactNumberRegex
     )
     self._special_number_with_unit_regex = None
     self._check_both_before_after = EnglishDateTime.CheckBothBeforeAfter
     # TODO When the implementation for these properties is added, change the None values to their respective Regexps
     self._special_number_unit_regex = None