code: def prepare_mwoz_21(
      data_folder: str,
      save_folder: str,
      replacements_path: str,
      skip_prep=False,
  ) -> None:
      """
      This class prepares the JSON files for the MultiWOZ dataset.
      Data will be automatically downloaded in the data_folder.
      Download link: https://github.com/budzianowski/multiwoz/tree/master/data
  
      Arguments
      ---------
      data_folder : str
          Path to the folder where the original MultiWOZ dataset is stored.
      save_folder : str
          The directory where to store the JSON files.
      replacements_path: str
          File containing (from, to) pairs, one per line for preprocessing the text.
      skip_prep: bool
          If True, data preparation is skipped.
  
  
      Example
      -------
      >>> data_folder = 'data/MultiWOZ_2.1'
      >>> save_folder = 'MultiWOZ_prepared'
      >>> replacements_path = 'mapping.pair'
      >>> prepare_mwoz_21(data_folder, save_folder, replacements_path)
      """
  
      if skip_prep:
          return
  
      # Saving folder
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
  
      # Setting ouput files
      save_train = save_folder + "/train.json"
      save_dev = save_folder + "/dev.json"
      save_test = save_folder + "/test.json"
  
      # If csv already exists, we skip the data preparation
      if skip(save_train, save_dev, save_test):
          msg = "%s already exists, skipping data preparation!" % (
              save_train
          )
          logger.info(msg)
  
          msg = "%s already exists, skipping data preparation!" % (
              save_dev
          )
          logger.info(msg)
  
          msg = "%s already exists, skipping data preparation!" % (
              save_test
          )
          logger.info(msg)
  
          return
  
      # Download dataset
      download_mwoz_21(data_folder)
      data_folder = os.path.join(data_folder, "MultiWOZ_21")
  
      # Additional checks to make sure the data folder contains MultiWOZ
      check_multiwoz_folders(data_folder)
  
      data_path = os.path.join(data_folder, "data.json")
      train_split, dev_split, test_split = get_splits(data_folder)
      # Creating json files for {train, dev, test} data
      file_pairs = zip(
          [train_split, dev_split, test_split],
          [save_train, save_dev, save_test],
      )
  
      for split, save_file in file_pairs:
          build_dialogue_dataset(
              data_path,
              split,
              save_file,
              replacements_path,
          )
  
imports: from itertools import product
  from statistics import mean
  from typing import Any, Dict, List, Optional, Set, Tuple
  import json
  import logging
  import os
  import re
  import shutil
  from tqdm import tqdm
  from speechbrain.utils.data_utils import download_file
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_mwoz_21(data_folder, save_folder, replacements_path, skip_prep) without return types