123456789101112131415 |
- def pseudonymize_html_text(replacements, text):
- """ Create html blocs with pseudos in place of NER for dash tool"""
- index = 0
- pseudonymized_text = ''
- for key in sorted(replacements.keys()):
- chunk = text[index:key[0]]
- # print(text[key[0]:key[1]])
- pseudonymized_text += chunk
- pseudonymized_text += "<ano>" + replacements[key] + "</ano>"
- index = key[1]
- pseudonymized_text += text[index:]
- return pseudonymized_text
|