class_docstr: CoQA is a large-scale dataset for building Conversational Question Answering systems.
class_docstr_tok: ["CoQA","is","a","large-scale","dataset","for","building","Conversational","Question","Answering","systems","."]
code: def _generate_examples(self, filepath, split):
      with open(filepath, encoding="utf-8") as f:
          data = json.load(f)
          for row in data["data"]:
              id = row["id"]
              source = row["source"]
              story = row["story"]
              questions = [
                  {
                      "input_text": q["input_text"],
                      "turn_id": q["turn_id"],
                  }
                  for q in row["questions"]
              ]
              answers = [
                  {
                      "span_start": a["span_start"],
                      "span_end": a["span_end"],
                      "span_text": a["span_text"],
                      "input_text": a["input_text"],
                      "turn_id": a["turn_id"],
                  }
                  for a in row["answers"]
              ]
              if split == datasets.Split.TRAIN:
                  additional_answers = _EMPTY_ADDITIONAL_ANSWER
              else:
                  additional_answers = {
                      "0": [
                          {
                              "span_start": a0["span_start"],
                              "span_end": a0["span_end"],
                              "span_text": a0["span_text"],
                              "input_text": a0["input_text"],
                              "turn_id": a0["turn_id"],
                          }
                          for a0 in row["additional_answers"]["0"]
                      ],
                      "1": [
                          {
                              "span_start": a1["span_start"],
                              "span_end": a1["span_end"],
                              "span_text": a1["span_text"],
                              "input_text": a1["input_text"],
                              "turn_id": a1["turn_id"],
                          }
                          for a1 in row["additional_answers"]["1"]
                      ],
                      "2": [
                          {
                              "span_start": a2["span_start"],
                              "span_end": a2["span_end"],
                              "span_text": a2["span_text"],
                              "input_text": a2["input_text"],
                              "turn_id": a2["turn_id"],
                          }
                          for a2 in row["additional_answers"]["2"]
                      ],
                  }
              yield row["id"], {
                  "id": id,
                  "story": story,
                  "source": source,
                  "questions": questions,
                  "answers": answers,
                  "additional_answers": additional_answers,
              }
  
imports: import json
  import datasets
label_desc: Use image node_id 3 for calling the Coqa obj's underlying member method code with example usage: obj._generate_examples(filepath, split) without return types