code: def __init__(self, mapping: Optional[Union[str, Dict[str, Any]]]):
      if isinstance(mapping, str):
          local_mapping_path = pathmgr.get_local_path(mapping)
          with open(local_mapping_path) as json_file:
              self.mapping = {
                  k.lower(): v for k, v in json.load(json_file).items()
              }
      elif isinstance(mapping, Dict):
          self.mapping = mapping
      else:
          self.mapping = {}
  
file_path: AugLy/augly/text/augmenters/word_replacement.py
imports: import json
  from typing import Any, Dict, List, Optional, Tuple, Union
  from augly.text.augmenters.utils import detokenize, get_aug_idxes, tokenize
  from augly.utils import pathmgr
  from augly.utils.libsndfile import install_libsndfile
  from nlpaug.augmenter.word import WordAugmenter
  from nlpaug.util import Action, Method
label_desc: Use image node_id 1 to create a new WordReplacement object  with example: obj = WordReplacement(mapping)