def check_holding(self, token, idx): tempList = ['ka', 'kha', 'ga', 'gha', 'uma', 'ca', 'cha', 'ja', 'jha', 'za', 'zha', 'ta', 'tha', 'da', 'dha', 'na', 'pa', 'pha', 'fa', 'ma', 'ra', 'la', 'ha', 'ya', 'gp', 'rrrr'] if (any(char.isdigit() for char in token) or token in tempList or re.match(r'^[a-z]$', token)) and idx < len(self.tempArray)-1 and (self.matched[self.housekey] == None or self.matched[self.housekey] == ''): if idx == 0 and self.tempArray[idx+1].lower() != 'floor': self.matched[self.housekey] = token #print('holding token 267') #print(token) if ((any(char.isdigit() for char in self.tempArray[idx+1])) or re.match(r'^[a-z]$', self.tempArray[idx+1]) or (self.tempArray[idx+1] in tempList)) and idx < len(self.tempArray)-2: self.matched[self.housekey] = self.matched[self.housekey] + "-"+self.tempArray[idx+1] if idx < len(self.tempArray)-3: if ((any(char.isdigit() for char in self.tempArray[idx+2])) or re.match(r'^[a-z]$', self.tempArray[idx+2]) or (self.tempArray[idx+2] in tempList)): self.matched[self.housekey] = self.matched[self.housekey] + "-"+self.tempArray[idx+2] return True if self.tempArray[idx-1].lower() not in self.address_component: check_match = 0 #print('279------------') #print(token) area_list = load_data.get_subarea() for j, area in enumerate(area_list): if area[0].lower() == self.tempArray[idx-1].lower(): check_match = 1 break if self.matched[self.housekey] == None: self.matched[self.housekey] = "" if check_match == 0 and token not in self.matched[self.housekey]: self.matched[self.housekey] = token #print('290----------- '+self.matched[self.housekey]) if ((any(char.isdigit() for char in self.tempArray[idx+1])) or re.match(r'^[a-z]$', self.tempArray[idx+1]) or (self.tempArray[idx+1] in tempList)) and idx < len(self.tempArray)-2: self.matched[self.housekey] = self.matched[self.housekey] + "-"+self.tempArray[idx+1] if ((any(char.isdigit() for char in self.tempArray[idx+2])) or re.match(r'^[a-z]$', self.tempArray[idx+2]) or (self.tempArray[idx+2] in tempList)) and idx < len(self.tempArray)-3: self.matched[self.housekey] = self.matched[self.housekey] + "-"+self.tempArray[idx+2] return True return True elif ((token.lower() == 'house' or token.lower() == 'plot') and idx < len(self.tempArray)-1): tempList = set(tempList) if (any(char.isdigit() for char in self.tempArray[idx+1])) or (self.tempArray[idx+1] in tempList) or (re.match(r'^[a-z]$', self.tempArray[idx+1])) or (re.match(r'^[a-z]/[a-z]$', self.tempArray[idx+1])): # chk_house_no=re.search(r'\w', self.tempArray[idx+1].strip(",")) # if chk_house_no: self.matched[self.housekey] = self.tempArray[idx+1] if idx < len(self.tempArray)-2: p1 = re.match(r'[0-9]+', self.tempArray[idx+2]) p2 = re.match(r'^[a-z]$', self.tempArray[idx+2]) p3 = re.match(r'^[A-Z]$', self.tempArray[idx+2]) if p1 or p2 or p3 or (self.tempArray[idx+2] in tempList): self.matched[self.housekey] = self.tempArray[idx+1] + "-"+self.tempArray[idx+2] if idx < len(self.tempArray)-3: if ((any(char.isdigit() for char in self.tempArray[idx+3])) or re.match(r'^[a-z]$', self.tempArray[idx+3]) or (self.tempArray[idx+3] in tempList)): self.matched[self.housekey] = self.matched[self.housekey] + "-"+self.tempArray[idx+3] # matched_array.append(tempArray[idx+1]) return True