class_docstr: Processor for the ARC data set (request from allennlp).
docstr: Creates examples for the training and dev sets.
docstr_tok: ["Creates","examples","for","the","training","and","dev","sets","."]
code: def _create_examples(self, lines, type):
      """Creates examples for the training and dev sets."""
  
      # There are two types of labels. They should be normalized
      def normalize(truth):
          if truth in "ABCD":
              return ord(truth) - ord("A")
          elif truth in "1234":
              return int(truth) - 1
          else:
              logger.info("truth ERROR! %s", str(truth))
              return None
  
      examples = []
      three_choice = 0
      four_choice = 0
      five_choice = 0
      other_choices = 0
      # we deleted example which has more than or less than four choices
      for line in tqdm.tqdm(lines, desc="read arc data"):
          data_raw = json.loads(line.strip("\n"))
          if len(data_raw["question"]["choices"]) == 3:
              three_choice += 1
              continue
          elif len(data_raw["question"]["choices"]) == 5:
              five_choice += 1
              continue
          elif len(data_raw["question"]["choices"]) != 4:
              other_choices += 1
              continue
          four_choice += 1
          truth = str(normalize(data_raw["answerKey"]))
          assert truth != "None"
          question_choices = data_raw["question"]
          question = question_choices["stem"]
          id = data_raw["id"]
          options = question_choices["choices"]
          if len(options) == 4:
              examples.append(
                  InputExample(
                      example_id=id,
                      question=question,
                      contexts=[
                          options[0]["para"].replace("_", ""),
                          options[1]["para"].replace("_", ""),
                          options[2]["para"].replace("_", ""),
                          options[3]["para"].replace("_", ""),
                      ],
                      endings=[
                          options[0]["text"],
                          options[1]["text"],
                          options[2]["text"],
                          options[3]["text"],
                      ],
                      label=truth,
                  )
              )
  
      if type == "train":
          assert len(examples) > 1
          assert examples[0].label is not None
      logger.info("len examples: %s}", str(len(examples)))
      logger.info("Three choices: %s", str(three_choice))
      logger.info("Five choices: %s", str(five_choice))
      logger.info("Other choices: %s", str(other_choices))
      logger.info("four choices: %s", str(four_choice))
  
      return examples
  
imports: import csv
  import glob
  import json
  import logging
  import os
  from dataclasses import dataclass
  from enum import Enum
  from typing import List, Optional
  import tqdm
  from filelock import FileLock
  from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available
label_desc: Use image node_id 6 for calling the ArcProcessor obj's underlying member method code with example usage: obj._create_examples(lines, type) and returns: examples, unknown, unknown, None