2021-12-26 12:35:31
def Identifier2(input_address):
    # input_address=preprocessor.preprocessing(input_address)
    # input_address=input_address.lower()
    # input_address=synonym.preprocess_string(input_address)
    result_list=[]
    for district_key,district_info in DSU.items():
      find_subdistrict="None"
      find_union="None"
      result_dictionary={}
      c_area=[]
      tag=0
      try:
        #district_info['area_regex']=district_info['area_regex'].strip('\s+')
        if re.search('\s+'+district_info['District_regex']+'\s+',' '+input_address+' '):
          #print('area_regex')
          rd=district_key
          c_area.append(district_key)
      except:
        pass
 
      for subdistrict_key,subdistrict_info in district_info['Sub District'].items():
 
        find=0
        if ' '+subdistrict_key.lower()+' ' in ' '+input_address.lower()+' ' and len(subdistrict_key)!=0:
            find_subdistrict=subdistrict_key
            x=subdistrict_info['Union']
            for o in x:
              if finalresult(o,input_address)==True:
                find_union=o
                #print("Yes",find_union)
                break
        if find_subdistrict=="None":
          try:
            if re.search('\s+'+subdistrict_info['Subdistrict_regex']+'\s+',' '+input_address+' ') and len(subdistrict_key)!=0:
              find_subdistrict=subdistrict_key
              x=subdistrict_info['Union']             
              if len(x)!=0:
                for o in x:
                  if finalresult(o,input_address)==True:
                    find_union=o
                    break
                find+=1
              #break
          except Exception:
            pass
        # if find_subdistrict=="None":
        #   if finalresult(subdistrict_key.lower(),input_address)==True and 'block' not in subdistrict_key.lower() and len(subdistrict_key)!=0:
        #     find_subdistrict=subdistrict_key
        #     x=subdistrict_info['superfind_subdistrict']
        #     for o in x:
        #       if finalresult(o,input_address)==True and 'Block' not in o and 'Sector' not in o:
        #         find_union=o
        #         break
        #     find+=1
        #     break
 
      if find_subdistrict!="None" and len(find_subdistrict)!=0 and find_subdistrict not in area_as_ds:
        result_dictionary["district"]=district_key
        result_dictionary["sub_district"]=find_subdistrict
        result_dictionary["union"]=find_union
        result_dictionary['tag']=tag
        result_list.append(result_dictionary)
        break 
 
    if len(c_area)!=0:
      result_dictionary["district"]=c_area[0]
      result_dictionary["sub_district"]="None"
      result_dictionary["union"]="None"
      result_dictionary['tag']=1
      result_list.append(result_dictionary)
    return result_list
 

This is the pop-up flow.

[close]

def trim(s)
    if s[0:3]=='\s+':
        print(s[0:3])
        s = s.replace(s[0:3], '', 1)
    if s[len(s) - 3:]=='\s+':
        s = s.replace(s[len(s) - 3:], '')
 
    return s
Invalid Email or Password