code: def main(args):
      num_process = min(multiprocessing.cpu_count(), args.num_process)
      if args.mode == "download":
          download_wikicorpus(args.lang, args.date, args.output)
      elif args.mode == "format":
          format_wikicorpus(
              args.input,
              args.output,
              args.bytes,
              num_process,
              args.num_out_files,
              args.quiet,
          )
      elif args.mode == "download+format":
          downloaded_file = download_wikicorpus(
              args.lang, args.date, args.output
          )
          format_wikicorpus(
              downloaded_file,
              args.output,
              args.bytes,
              num_process,
              args.num_out_files,
              args.quiet,
          )
      elif args.mode == "download_prepared":
          url = _URLS["wikipedia-en-20200620"]
          file_hash = _URL_FILE_STATS[url]
          target_download_location = os.path.join(
              args.output, os.path.basename(url)
          )
          download(url, target_download_location, sha1_hash=file_hash)
          tar = tarfile.open(target_download_location)
          names = tar.getnames()
          print("Start unarchiving raw text files")
          start_time = time.time()
          for name in names:
              tar.extract(name, path=args.output)
          tar.close()
          print(
              "Done unarchiving within {:.2f} seconds".format(
                  time.time() - start_time
              )
          )
      else:
          raise NotImplementedError
      if args.segment_sentences:
          print("start to transfer bookcorpus to one sentence per line")
          t1 = time.time()
          segmenter = NLTKSegmenter()
          original_name = os.path.join(
              args.output, "prepared_wikipedia"
          )
          output_name = os.path.join(
              args.output, "one_sentence_per_line/"
          )
          if not os.path.exists(output_name):
              os.mkdir(output_name)
          input_names = os.listdir(original_name)
          for i in range(len(input_names)):
              input_names[i] = os.path.join(
                  original_name, input_names[i]
              )
          sharding = Sharding(
              input_names,
              output_name,
              256,
              1,
              0,
              args.segment_num_worker,
          )
  
          sharding.load_articles()
          sharding.segment_articles_into_sentences()
          t2 = time.time()
          print("transfer cost:{}".format(t2 - t1))
  
imports: import os
  import sys
  import glob
  import math
  import time
  import tarfile
  import argparse
  import multiprocessing
  from collections import defaultdict
  from gluonnlp.utils.misc import download, load_checksum_stats
  from gluonnlp.utils.lazy_imports import try_import_wikiextractor
  from gluonnlp.base import get_repo_url
  from itertools import islice
  import nltk
  import statistics
  from segment_sentences import Sharding, segment_sentences, NLTKSegmenter
label_desc: Use image node_id 7 for calling a global function with example usage: main(args) without return types