daterecognition/parser.py
def parse_string(self, query_string):
        """
            Method to parse string and extract dates
        """
        query_string = query_string.lower()
        matches = {}
        for k in self.patterns:
            for v in self.patterns[k]:
                if v in query_string:
                    if k not in matches:
                        matches[k] = []
                    matches[k] += self.find_repeat_matches(query_string, v, k)

        priority_matches = self.priority_matches(matches)
        if len(priority_matches.keys()) > 0:
            token_spans = self.get_token_spans(query_string)
            match_tokens = self.get_match_tokens(priority_matches, token_spans)
            ret_list = []
            for m in match_tokens:
                ret_list.append({
                    "string": m[0],
                    "char_start_idx": m[1],
                    "char_end_idx": m[2],
                    "date_format": m[3],
                    "token_start_idx": m[4],
                    "token_end_idx": m[5]
                })
            return ret_list
        return []

            Method to parse string and extract dates
        
Method to parse string and extract dates
Method to parse string and extract dates
def parse_string(self, query_string):
        query_string = query_string.lower()
        matches = {}
        for k in self.patterns:
            for v in self.patterns[k]:
                if v in query_string:
                    if k not in matches:
                        matches[k] = []
                    matches[k] += self.find_repeat_matches(query_string, v, k)
        priority_matches = self.priority_matches(matches)
        if len(priority_matches.keys()) > 0:
            token_spans = self.get_token_spans(query_string)
            match_tokens = self.get_match_tokens(priority_matches, token_spans)
            ret_list = []
            for m in match_tokens:
                ret_list.append({
                    "string": m[0],
                    "char_start_idx": m[1],
                    "char_end_idx": m[2],
                    "date_format": m[3],
                    "token_start_idx": m[4],
                    "token_end_idx": m[5]
                })
            return ret_list
        return []
def parse_string ( self , query_string ) : query_string = query_string . lower ( ) matches = { } for k in self . patterns : for v in self . patterns [ k ] : if v in query_string : if k not in matches : matches [ k ] = [ ] matches [ k ] += self . find_repeat_matches ( query_string , v , k ) priority_matches = self . priority_matches ( matches ) if len ( priority_matches . keys ( ) ) > 0 : token_spans = self . get_token_spans ( query_string ) match_tokens = self . get_match_tokens ( priority_matches , token_spans ) ret_list = [ ] for m in match_tokens : ret_list . append ( { "string" : m [ 0 ] , "char_start_idx" : m [ 1 ] , "char_end_idx" : m [ 2 ] , "date_format" : m [ 3 ] , "token_start_idx" : m [ 4 ] , "token_end_idx" : m [ 5 ] } ) return ret_list return [ ]
Method to parse string and extract dates
Method to parse string and extract dates
"""
            Method to parse string and extract dates
        """
self
query_string