import logging


def create_augmented_examples(orig_examples,
                              converter,
                              split,
                              log_every = 1000):
  """Creates AugmentedExamples from the raw JSONLs.

  Args:
    orig_examples: An Iterable of deserialzied JSONs.
    converter: A subclass of BaseExampleConverter.
    split: Split name (used only for logging).
    log_every: Logging frequency.

  Returns:
    a list of AugmentedExamples.
  """
  examples = []
  for i, orig_example in enumerate(orig_examples):
    if i % log_every == 0:
      logging.info("[%s:%d] Produced %d examples", split, i, len(examples))
    converter.verify_exemplars(orig_example)
    examples.extend(converter.convert(orig_example))
  logging.info("[%s] Produced %d examples total.", split, len(examples))
  return examples