code: def parse_esnli(fn, reasoning, savefile):
      json_lines = []
      reasonings = {}
      with open(reasoning, "r") as f:
          json_lines = json.load(f)
  
      for json_line in json_lines:
          reasonings[json_line["key"]] = json_line
  
      with open(fn, "r") as f:
          csv_reader = csv.reader(f, delimiter=",")
  
          c = 0
          structs = []
          for line in csv_reader:
              if c == 0:
                  c += 1
                  continue
  
              struct = {}
              answer = line[1]
              if answer == "entailment":
                  struct["answer"] = "yes"
              elif answer == "contradiction":
                  struct["answer"] = "no"
              else:
                  continue
              struct["key"] = line[0]
              struct["premise"] = line[2]
              struct["hypothesis"] = line[3]
              struct["explanation_1"] = line[4]
              struct["explanation_2"] = line[9]
              struct["explanation_3"] = line[14]
  
              if struct["key"] in reasonings:
                  reasoning = reasonings[struct["key"]]["reasoning"]
                  struct["gpt-3"] = reasoning
                  structs.append(struct)
              else:
                  val = struct["key"]
                  print(f"No reasoning found for key {val}")
  
              if len(structs) > 150:
                  break
  
      write_to_file(structs, savefile)
  
file_path: ParlAI/projects/roscoe/roscoe_data/restore_annotated.py
imports: import json
  import csv
  import os
  import re
  import xmltodict
  from parlai.core.params import ParlaiParser
label_desc: Use image node_id 3 for calling a global function with example usage: parse_esnli(fn, reasoning, savefile) without return types