code: def build(opt):
      dpath = os.path.join(opt["datapath"], "NarrativeQA")
      version = None
  
      if not build_data.built(dpath, version_string=version):
          print("[building data: " + dpath + "]")
  
          if build_data.built(dpath):
              # an older version exists, so remove these outdated files.
              build_data.remove_dir(dpath)
          build_data.make_dir(dpath)
  
          # Download the data.
          for downloadable_file in RESOURCES:
              downloadable_file.download_file(dpath)
  
          print("downloading stories now")
          base_path = os.path.join(dpath, "narrativeqa-master")
  
          download_stories(base_path)
  
          # move from tmp to stories
          tmp_stories_path = os.path.join(base_path, "tmp")
          new_stories_path = os.path.join(base_path, "stories")
          shutil.move(tmp_stories_path, new_stories_path)
  
          # divide into train, valid and test for summaries
          summaries_csv_path = os.path.join(
              base_path, "third_party", "wikipedia", "summaries.csv"
          )
          new_path = os.path.join(base_path, "summaries.csv")
          shutil.move(summaries_csv_path, new_path)
  
          divide_csv_into_sets(new_path)
  
          # divide into sets for questions
          questions_path = os.path.join(base_path, "qaps.csv")
          divide_csv_into_sets(questions_path)
  
          # divide into sets for documents
          documents_path = os.path.join(base_path, "documents.csv")
          divide_csv_into_sets(documents_path)
  
          # move specific set's files into their set's folder
          make_folders(base_path)
          move_files(base_path)
  
          # move narrativeqa-master to narrative_qa
          new_path = os.path.join(dpath, "narrative_qa")
          shutil.move(base_path, new_path)
  
          # mark the data as built
          build_data.mark_done(dpath, version_string=version)
  
file_path: ParlAI/parlai/tasks/narrative_qa/build.py
imports: import parlai.core.build_data
  import os
  import subprocess
  import shutil
  import csv
  import time
  from parlai.core.build_data import DownloadableFile
  from parlai.utils.io import PathManager
label_desc: Use image node_id 9 for calling a global function with example usage: build(opt) without return types