I need to test if a string contains one of strings in a list, ignoring the accents.
I tried using for + in + if + unidecode but without success:
from unidecode import unidecode
def temServentiaExclusiva(nome_orgao):
#fix-me: pegar ids dinamicamente
regras = [
{'especializada_id':70, 'termos': [u'orfaos e sucessoes', u'familia']}
]
for r in regras:
#if(unidecode(nome_orgao) in s for s in r['termos']):
if([t for t in r['termos'] if(t in unidecode(nome_orgao))]):
return r['especializada_id']
print(temServentiaExclusiva('orfãos'))
print(temServentiaExclusiva('Cartório da 6ª Vara de Orfãos e Sucessões'))
The result was None :(
So, How can I achieve that?