# Path: prompt_tuning/data/constants.py
# PREDICTION = "prediction"
# PREDICTION_TEXT = "prediction_pretokenized"
# INPUT_FIELD = "inputs"
# INPUT_TEXT = "inputs_pretokenized"
# TARGET_FIELD = "targets"
# TARGET_TEXT = "targets_pretokenized"
# CONTEXT_TEXT = "context"
# QUESTION_TEXT = "question"
# ANSWERS_TEXT = "answers"
# EXTRA_ID_0 = "<extra_id_0>"
# EQUIVALENT = "equivalent"
# DUPLICATE = "duplicate"


import itertools
import random
import textwrap
import seqio
import six
from typing import Sequence, Optional, Dict, List, Mapping, Any
from prompt_tuning.data import constants
         """.lstrip("\n"))
    texts.append(example_text)
  return "\n\n".join(texts)


# pylint: disable=unused-argument
def format_qa(indices: Sequence[int],
              examples: List[Mapping[str, Any]],
              context_field: str = constants.CONTEXT_TEXT,
              question_field: str = constants.QUESTION_TEXT,
              answers_field: str = constants.ANSWERS_TEXT,
              prediction_field: str = constants.PREDICTION_TEXT,
              **kwargs) -> str:
  """Format text output for qa tasks."""
  texts = []
  for idx in indices:
    example_text = textwrap.dedent(f"""
      context: {six.ensure_text(examples[idx][context_field])}\n
      question: {six.ensure_text(examples[idx][question_field])}\n
      answers: {"; ".join([six.ensure_text(a) for a in examples[idx][answers_field]])}\n
      prediction: {six.ensure_text(examples[idx][prediction_field])}\n
      """.lstrip("\n"))
    texts.append(example_text)
  return "\n\n".join(texts)


def label_set_stats(
    targets,
    predictions,
    task_name: str,

# Path: prompt_tuning/data/constants.py
# PREDICTION = "prediction"
# PREDICTION_TEXT = "prediction_pretokenized"
# INPUT_FIELD = "inputs"
# INPUT_TEXT = "inputs_pretokenized"
# TARGET_FIELD = "targets"
# TARGET_TEXT = "targets_pretokenized"
# CONTEXT_TEXT = "context"
# QUESTION_TEXT = "question"
# ANSWERS_TEXT = "answers"
# EXTRA_ID_0 = "<extra_id_0>"
# EQUIVALENT = "equivalent"
# DUPLICATE = "duplicate"


# Path: prompt_tuning/data/metrics.py
import itertools
import random
import textwrap
import seqio
import six
from typing import Sequence, Optional, Dict, List, Mapping, Any
from prompt_tuning.data import constants

         """.lstrip("\n"))
    texts.append(example_text)
  return "\n\n".join(texts)


# pylint: disable=unused-argument
def format_qa(indices: Sequence[int],
              examples: List[Mapping[str, Any]],
              context_field: str = constants.CONTEXT_TEXT,
              question_field: str = constants.QUESTION_TEXT,
              answers_field: str = constants.ANSWERS_TEXT,
              prediction_field: str = constants.PREDICTION_TEXT,
              **kwargs) -> str:
  """Format text output for qa tasks."""
  texts = []
  for idx in indices:
    example_text = textwrap.dedent(f"""
      context: {six.ensure_text(examples[idx][context_field])}\n
      question: {six.ensure_text(examples[idx][question_field])}\n
      answers: {"; ".join([six.ensure_text(a) for a in examples[idx][answers_field]])}\n
      prediction: {six.ensure_text(examples[idx][prediction_field])}\n
      """.lstrip("\n"))
    texts.append(example_text)
  return "\n\n".join(texts)


def label_set_stats(
    targets,
    predictions,
    task_name: str,

    target_field: str = constants.TARGET_TEXT,