code: def main(args):
      url = _URLS["books1"]
      file_hash = _URL_FILE_STATS[url]
      target_download_location = os.path.join(
          args.cache_path, 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
          )
      )
      print("start transfer to one article per line")
      input_name = os.path.join(args.output, "books1/epubtxt/")
      output_name = os.path.join(args.output, "bookcorpus.txt")
      format = BookscorpusTextFormatting(input_name, output_name)
      format.merge()
      print("end format")
      if args.segment_sentences:
          print("start to transfer bookcorpus to one sentence per line")
          t1 = time.time()
  
          input_name = os.path.join(args.output, "bookcorpus.txt")
          output_name = os.path.join(
              args.output, "one_sentence_per_line/"
          )
          if not os.path.exists(output_name):
              os.mkdir(output_name)
          sharding = Sharding(
              [input_name],
              output_name,
              128,
              1,
              0,
              args.segment_num_worker,
          )
  
          sharding.load_articles()
          sharding.segment_articles_into_sentences()
          t2 = time.time()
          print("transfer cost:{}".format(t2 - t1))
  
file_path: gluon-nlp/src/gluonnlp/cli/data/pretrain_corpus/prepare_bookcorpus.py
imports: import os
  import tarfile
  import argparse
  import glob
  from gluonnlp.base import get_data_home_dir
  from gluonnlp.utils.misc import download, load_checksum_stats
  from collections import defaultdict
  from itertools import islice
  import time
  import multiprocessing
  import statistics
  import nltk
  import sys
  from segment_sentences import Sharding, segment_sentences, NLTKSegmenter
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types