code: def format_mrpc(data_dir, path_to_data):
      print("Processing MRPC...")
      mrpc_dir = os.path.join(data_dir, "MRPC")
      if not os.path.isdir(mrpc_dir):
          os.mkdir(mrpc_dir)
      if path_to_data:
          mrpc_train_file = os.path.join(
              path_to_data, "msr_paraphrase_train.txt"
          )
          mrpc_test_file = os.path.join(
              path_to_data, "msr_paraphrase_test.txt"
          )
      else:
          mrpc_train_file = os.path.join(
              mrpc_dir, "msr_paraphrase_train.txt"
          )
          mrpc_test_file = os.path.join(
              mrpc_dir, "msr_paraphrase_test.txt"
          )
      assert os.path.isfile(mrpc_train_file), (
          "Train data not found at %s" % mrpc_train_file
      )
      assert os.path.isfile(mrpc_test_file), (
          "Test data not found at %s" % mrpc_test_file
      )
      urllib.request.urlretrieve(
          TASK2PATH["MRPC"], os.path.join(mrpc_dir, "dev_ids.tsv")
      )
  
      dev_ids = []
      with open(os.path.join(mrpc_dir, "dev_ids.tsv")) as ids_fh:
          for row in ids_fh:
              dev_ids.append(row.strip().split("\t"))
  
      with open(mrpc_train_file) as data_fh, open(
          os.path.join(mrpc_dir, "train.tsv"), "w"
      ) as train_fh, open(
          os.path.join(mrpc_dir, "dev.tsv"), "w"
      ) as dev_fh:
          header = data_fh.readline()
          train_fh.write(header)
          dev_fh.write(header)
          for row in data_fh:
              label, id1, id2, s1, s2 = row.strip().split("\t")
              if [id1, id2] in dev_ids:
                  dev_fh.write(
                      "%s\t%s\t%s\t%s\t%s\n" % (label, id1, id2, s1, s2)
                  )
              else:
                  train_fh.write(
                      "%s\t%s\t%s\t%s\t%s\n" % (label, id1, id2, s1, s2)
                  )
      with open(mrpc_test_file) as data_fh, open(
          os.path.join(mrpc_dir, "test.tsv"), "w"
      ) as test_fh:
          _ = data_fh.readline()
          test_fh.write("index\t#1 ID\t#2 ID\t#1 String\t#2 String\n")
          for idx, row in enumerate(data_fh):
              label, id1, id2, s1, s2 = row.strip().split("\t")
              test_fh.write(
                  "%d\t%s\t%s\t%s\t%s\n" % (idx, id1, id2, s1, s2)
              )
      print("\tCompleted!")
  
file_path: texar/examples/bert/data/download_glue_data.py
imports: import argparse
  import os
  import sys
  import urllib.request
  import zipfile
label_desc: Use image node_id 2 for calling a global function with example usage: format_mrpc(data_dir, path_to_data) without return types