code: def combine(
      split_dir: str,
      num_splits: int,
      output_dir: str,
      text_file: str,
      vocab_file: str,
      add_symbol: Optional[str],
  ):
      extra_symbol_list = []
      if add_symbol:
          extra_symbol_list = add_symbol
  
      output_text = Path(output_dir, text_file)
      output_text.parent.mkdir(parents=True, exist_ok=True)
      ot_f = output_text.open("w", encoding="utf-8")
  
      output_vocab = Path(output_dir, vocab_file)
      output_vocab.parent.mkdir(parents=True, exist_ok=True)
      ov_f = output_vocab.open("w", encoding="utf-8")
  
      vocab_dict = defaultdict(int)
  
      # read each text file in split_dir/{1,2,...,num_splits}/text_file
      for i in tqdm(range(num_splits)):
          index = i + 1
          text_f = Path(split_dir, str(index), text_file).open(
              "r", encoding="utf-8"
          )
          for line in text_f:
              line = line.rstrip()
              if len(line) > 0:
                  for token in line.split():
                      vocab_dict[token] += 1
              ot_f.write(f"{line}\n")
      ot_f.close()
  
      for token in extra_symbol_list:
          if token not in vocab_dict:
              ov_f.write(f"{token}\n")
      for token, counts in vocab_dict.items():
          ov_f.write(f"{token}\n")
      ov_f.close()
  
file_path: espnet/egs2/slue-voxceleb/asr1/pyscripts/text/combine_text_and_vocab.py
imports: import argparse
  import sys
  from collections import defaultdict
  from pathlib import Path
  from typing import Optional
  from tqdm import tqdm
  from espnet.utils.cli_utils import get_commandline_args
label_desc: Use image node_id 2 for calling a global function with example usage: combine(split_dir, num_splits, output_dir, text_file, vocab_file, add_symbol) without return types