def Check_Reverse_Key(self, s): house_key = '' road_key = '' block_key = '' sector_key = '' goli_key = '' # s='oaishf ka/4 no house las, 4 number road block no 5' pattern_house = re.search('(ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*\s+house\s+', s) pattern_road = re.search('(ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*\s+road\s+', s) pattern_goli = re.search('(ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*\s+goli\s+', s) pattern_lane = re.search('(ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*\s+lane\s+', s) pattern_line = re.search('(ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*\s+line\s+', s) pattern_block = re.search('(((ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*block)|((\s+[a-z]))\s+block\s+)', s) pattern_sector = re.search('(ka)*[a-z]*\d*/*[a-z]*(ka)*\d+\s+(no|number)\s*[.]*\s+sector\s+', s) pattern_road_feet = re.search('\s+\d+\s*(feet|(ft[.]*|foot)\s+)', s) if pattern_road_feet: road_feet = re.search("\d+", pattern_road_feet.group()) # print(road_feet.group()) self.reverse_road_pattern = True self.reverse_pattern['road'] = str(road_feet.group())+" feet road" if pattern_house: house_key = pattern_house.group().split()[0] #print("house "+house_key) self.reverse_house_pattern = True self.reverse_pattern['house'] = house_key if pattern_road: road_key = pattern_road.group().split()[0] self.reverse_road_pattern = True #print("road "+road_key) self.reverse_pattern['road'] = "road "+road_key if pattern_goli: goli_key = pattern_goli.group() self.reverse_goli_pattern = True #print("goli "+goli_key) self.reverse_pattern['goli'] = goli_key if pattern_lane: lane_key = pattern_lane.group().split()[0] self.reverse_lane_pattern = True #print("lane "+lane_key) self.reverse_pattern['lane'] = "lane "+lane_key if pattern_line: line_key = pattern_line.group().split()[0] self.reverse_line_pattern = True #print("lane "+lane_key) self.reverse_pattern['line'] = "line "+line_key if pattern_block: block_key = pattern_block.group().split()[0] self.reverse_block_pattern = True #print("block "+block_key) self.reverse_pattern['block'] = block_key if pattern_sector: sector_key = pattern_sector.group().split()[0] self.reverse_sector_pattern = True #print("sector "+sector_key) self.reverse_pattern['sector'] = "sector "+sector_key return None