def get_text_span(example, span):
  """Returns the text in the example's document in the given span."""
  byte_positions = []
  # `text` is a byte string since `document_plaintext` is also a byte string.
  start = span["plaintext_start_byte"]
  end = span["plaintext_end_byte"]
  text = byte_slice(example["document_plaintext"], start, end)
  for i in range(span["plaintext_start_byte"], span["plaintext_end_byte"]):
    byte_positions.append(i)
  return TextSpan(byte_positions, text)
Returns the text in the example's document in the given span.
language/canine/tydiqa/data.py