Example #1
0
 def extract_atom(text, src_time, **kwargs_ignore):
     # Wrap static methods for match function and match transform to close over src_time.
     def wrapped_match_function(nltext): return AbsoluteOneWayInnerDayModifierAtom.__match_function(nltext, src_time)
     def wrapped_match_transformer(match): return AbsoluteOneWayInnerDayModifierAtom.__match_transformer(match, src_time)
     matcher = SequentialMatcher(wrapped_match_function,\
             match_transformer=wrapped_match_transformer)
     return matcher.extract(text)
Example #2
0
    def extract_tags(text, src_time):
        # Wrap function to pass through params.
        def wrapped_match_function(nltext):
            match_res = RelativeOneWayMultiDayModifierAtom.__match_function(nltext)
            return match_res.get(u'match') if match_res else None

        matcher = SequentialMatcher(wrapped_match_function,\
                label=RelativeOneWayMultiDayModifierAtom.TAG)
        return matcher.extract(text)
Example #3
0
    def extract_atom(text, src_time, **kwargs_ignore):
        # Wrap function to pass through params.
        def wrapped_match_function(nltext):
            match_res = RelativeOneWayMultiDayModifierAtom.__match_function(nltext)
            return match_res.get(u'match') if match_res else None
        def wrapped_match_transformer(match):
            return RelativeOneWayMultiDayModifierAtom(match, src_time)

        matcher = SequentialMatcher(wrapped_match_function,\
                match_transformer=wrapped_match_transformer)
        return matcher.extract(text)
Example #4
0
 def extract_tags(text, src_time):
     def match_function(nltext): return utils.safe_parsedatetime_first_nlp(nltext, src_time, ignore='time').get(u'match')
     matcher = SequentialMatcher(match_function, label=CalendarDaterangeAtom.TAG);
     return matcher.extract(text)
Example #5
0
 def extract_atom(text, src_time, parse_type=u'range'):
     def match_function(nltext): return utils.safe_parsedatetime_first_nlp(nltext, src_time, ignore='time').get(u'match')
     def match_transformer(match): return CalendarDateRangeAtom(match, src_time, parse_type=parse_type)
     matcher = SequentialMatcher(match_function, match_transformer=match_transformer);
     return matcher.extract(text)
Example #6
0
 def extract_tags(text, src_time):
     parser = utils.safe_natural_daterange_parser
     def match_function(nltext): return parser(nltext, src_time).get(u'match')
     matcher = SequentialMatcher(match_function, label=NaturalDaterangeAtom.TAG)
     return matcher.extract(text)
Example #7
0
 def extract_atom(text, src_time, **kwargs_ignore):
     parser = utils.safe_natural_daterange_parser
     def match_function(nltext): return parser(nltext, src_time).get(u'match')
     def match_transformer(match): return NaturalDaterangeAtom(match, src_time)
     matcher = SequentialMatcher(match_function, match_transformer=match_transformer)
     return matcher.extract(text)
Example #8
0
 def extract_tags(text, *ignore):
     matcher = SequentialMatcher(OperandAtom.__match_function, label=u'OP')
     return matcher.extract(text)
Example #9
0
 def extract_atom(text, *args_ignore, **kwargs_ignore):
     matcher = SequentialMatcher(OperandAtom.__match_function, match_transformer=OperandAtom.__match_transformer)
     return matcher.extract(text)
Example #10
0
 def extract_tags(text, *ignore):
     matcher = SequentialMatcher(FillerAtom.__match_function, label=FillerAtom.TAG)
     return matcher.extract(text)
Example #11
0
 def extract_tags(text, *ignore):
     matcher = SequentialMatcher(NaturalInnerDayModifierAtom.__match_function, label=u'MOD')
     return matcher.extract(text)
Example #12
0
 def extract_atom(text, *ignore, **kwags_ignore):
     matcher = SequentialMatcher(NaturalInnerDayModifierAtom.__match_function,\
             match_transformer=NaturalInnerDayModifierAtom.__match_transformer)
     return matcher.extract(text)
Example #13
0
 def extract_tags(text, src_time):
     # Wrap static methods for match function and match transform to close over src_time.
     def wrapped_match_function(nltext): return AbsoluteOneWayInnerDayModifierAtom.__match_function(nltext, src_time)
     def wrapped_match_transformer(match): return AbsoluteOneWayInnerDayModifierAtom.__match_transformer(match, src_time)
     matcher = SequentialMatcher(wrapped_match_function, label=AbsoluteOneWayInnerDayModifierAtom.TAG)
     return matcher.extract(text)