def get_example(
    query,
    doc_title,
    doc_title_to_text,
    spm_wrapper,
    is_relevant,
    context_size
):
  """Adds a tuple representing an example to `outputs`."""
  if doc_title not in doc_title_to_text:
    raise Exception("Missing document title: %s" % doc_title)

  doc_text = doc_title + " " + doc_title_to_text[doc_title]
  truncated_text = spm_wrapper.truncate(doc_text, context_size)
  input_string = INPUT_FORMAT.format(
      query=query, doc=truncated_text)
  output_string = (
      POS_LABEL if is_relevant else NEG_LABEL)
  return (input_string, output_string)
Adds a tuple representing an example to `outputs`.
language/quest/xattn/xattn_utils.py