def process(self,
              entry,
              errors,
              debug_info=None) -> Iterator[tf.train.Example]:
    """Converts TyDi entries into serialized tf examples.

    Args:
      entry: "TyDi entries", dicts as returned by `create_entry_from_json`.
      errors: A list that this function appends to if errors are created. A
        non-empty list indicates problems.
      debug_info: A dict of information that may be useful during debugging.
        These elements should be used for logging and debugging only. For
        example, we log how the text was tokenized into WordPieces.

    Yields:
      `tf.train.Example` with the features needed for training or inference
      (depending on how `is_training` was set in the constructor).
    """
    if not debug_info:
      debug_info = {}
    tydi_example = data.to_tydi_example(entry, self.is_training)
    debug_info["tydi_example"] = tydi_example
    input_features = preproc.convert_single_example(
        tydi_example,
        tokenizer=self.tokenizer,
        is_training=self.is_training,
        max_question_length=self.max_question_length,
        max_seq_length=self.max_seq_length,
        doc_stride=self.doc_stride,
        include_unknowns=self.include_unknowns,
        errors=errors,
        debug_info=debug_info,
    )  # type: List[preproc.InputFeatures]
    for input_feature in input_features:
      input_feature.example_index = int(entry["id"])
      input_feature.unique_id = (
          input_feature.example_index + input_feature.doc_span_index)

      def create_int_feature(values):
        return tf.train.Feature(
            int64_list=tf.train.Int64List(value=list(values)))

      features = collections.OrderedDict()
      features["unique_ids"] = create_int_feature([input_feature.unique_id])
      features["example_index"] = create_int_feature(
          [input_feature.example_index])
      features["input_ids"] = create_int_feature(input_feature.input_ids)
      features["input_mask"] = create_int_feature(input_feature.input_mask)
      features["segment_ids"] = create_int_feature(input_feature.segment_ids)
      features["language_id"] = create_int_feature([input_feature.language_id])

      if self.is_training:
        features["start_positions"] = create_int_feature(
            [input_feature.start_position])
        features["end_positions"] = create_int_feature(
            [input_feature.end_position])
        features["answer_types"] = create_int_feature(
            [input_feature.answer_type])
      else:
        features["wp_start_offset"] = create_int_feature(
            input_feature.wp_start_offset)
        features["wp_end_offset"] = create_int_feature(
            input_feature.wp_end_offset)

      yield tf.train.Example(features=tf.train.Features(feature=features))
Converts TyDi entries into serialized tf examples.

    Args:
      entry: "TyDi entries", dicts as returned by `create_entry_from_json`.
      errors: A list that this function appends to if errors are created. A
        non-empty list indicates problems.
      debug_info: A dict of information that may be useful during debugging.
        These elements should be used for logging and debugging only. For
        example, we log how the text was tokenized into WordPieces.

    Yields:
      `tf.train.Example` with the features needed for training or inference
      (depending on how `is_training` was set in the constructor).
    
language/canine/tydiqa/tf_io.py