process_file_5.py 477 B

123456789101112131415
  1. def pseudonymize_html_text(replacements, text):
  2. """ Create html blocs with pseudos in place of NER for dash tool"""
  3. index = 0
  4. pseudonymized_text = ''
  5. for key in sorted(replacements.keys()):
  6. chunk = text[index:key[0]]
  7. # print(text[key[0]:key[1]])
  8. pseudonymized_text += chunk
  9. pseudonymized_text += "<ano>" + replacements[key] + "</ano>"
  10. index = key[1]
  11. pseudonymized_text += text[index:]
  12. return pseudonymized_text