I have written a function that looks like this
def mapping(a):
if a in ["A1" , "A2" , "A3" , "A4" , "A5" , "A6" , "A7"]:
return "Avyayıbhava"
elif a in ["Bs2" , "Bs3" , "Bs4" , "Bs5" , "Bs6" , "Bs7" , "Bsd" , "Bss" , "Bsu" , "Bsp" , "Bsg" , "Bvs" , "BvS" , "Bvp" , "BvU" , "Bsmn" , "Bb","BvP"]:
return "Bahuvrıhi"
elif a in ['Di' , "Ds" , "E"]:
return "Dvandva"
elif a in ["d" , "S"]:
return "anya"
elif a in ["T1" , "T2" , "T3" , "T4" , "T5" , "T6" , "T7" , "Tn" , "Tp" , "Tk" , "Tg" , "Td" , "Tdu" , "Tds" , "U" , "U2" , "U3" , "U4" , "U5" , "U7" , "Tm" , "Tb" , "K1" ,"k1" "K2" , "K3" , "K4" , "K5" , "K6" , "K7" , "Km"]:
return "Tatpurusa"
I tried it and it is working properly. Next up I have a list of tags that looks like this
' Bs6',
' T4',
' T6',
' Tg',
' T3',
' K1',
' T6',
' T4',
' T3',
' T6',
' K1',
' T6',
' T6',
' T4',
' Bs6',
' K1',
' Bs6',
' T3',
' T6',
' K1',
' T6',
' K1',
' T6',
It is a much bigger list with tags like this but this serves as a representation. I used the following script to read from the list and return proper values.
coarse_tags=[]
for tag in stringed_tags:
coarse_tags.append(mapping(tag))
However, this keeps giving me the result of none. Any modifications to the code that could help me? Secondly, the given list has the above w=mentioned values but the tags could be in a different case format too. So Bs1, BS1 and bs1 all exist in the list but refer to the same tag. How do I make the above function case insensitive?
What I have tried:
Created mapping function
def mapping(a):
if a in ["A1" , "A2" , "A3" , "A4" , "A5" , "A6" , "A7"]:
return "Avyayıbhava"
elif a in ["Bs2" , "Bs3" , "Bs4" , "Bs5" , "Bs6" , "Bs7" , "Bsd" , "Bss" , "Bsu" , "Bsp" , "Bsg" , "Bvs" , "BvS" , "Bvp" , "BvU" , "Bsmn" , "Bb","BvP"]:
return "Bahuvrıhi"
elif a in ['Di' , "Di" , "E"]:
return "Dvandva"
elif a in ["d" , "S"]:
return "anya"
elif a in ["T1" , "T2" , "T3" , "T4" , "T5" , "T6" , "T7" , "Tn" , "Tp" , "Tk" , "Tg" , "Td" , "Tdu" , "Tds" , "U" , "U2" , "U3" , "U4" , "U5" , "U7" , "Tm" , "Tb" , "K1" ,"k1" "K2" , "K3" , "K4" , "K5" , "K6" , "K7" , "Km"]:
return "Tatpurusa"
Wrote script for reading from list and giving correct coarse tag
coarse_tags=[]
for tag in stringed_tags:
coarse_tags.append(mapping(tag))