process_file_8.py 438 B

123456789101112131415
  1. def highlight_pseudo(paragraph):
  2. """ Hghlight pseudonymized text for Dash tool """
  3. index = 0
  4. new_str = []
  5. for change in re.finditer('<ano>(.*?)</ano>', paragraph):
  6. b = change.start(0)
  7. e = change.end(0)
  8. new_str.append(paragraph[index:b])
  9. new_str.append(html.Mark(change.group(1), style={'color': 'blue'}))
  10. index = e
  11. new_str.append(paragraph[index:])
  12. return html.P(new_str)