def render_entities_html(passage, m_starts, m_ends):
  """Add <b> tags to mark entities in string passage."""
  sorted_i = sorted(enumerate(m_ends), key=lambda x: x[1], reverse=True)
  for ii in sorted_i:
    passage = passage[:m_ends[ii[0]]] + "</b>" + passage[m_ends[ii[0]]:]
    passage = passage[:m_starts[ii[0]]] + "<b>" + passage[m_starts[ii[0]]:]
  return passage
Add <b> tags to mark entities in string passage.
language/labs/drkit/hotpotqa/demo.py