class_docstr: Augmenter that replaces words based on a given mapping
code: def __init__(
      self,
      aug_word_min: int,
      aug_word_max: int,
      aug_word_p: float,
      mapping: Optional[Union[str, Dict[str, Any]]],
      priority_words: Optional[List[str]],
      ignore_words: Optional[List[str]],
  ):
      super().__init__(
          action=Action.SUBSTITUTE,
          aug_min=aug_word_min,
          aug_max=aug_word_max,
          aug_p=aug_word_p,
      )
      self.word_mapping = self.get_mapping(mapping)
      self.priority_words = (
          set(priority_words)
          if priority_words is not None
          else priority_words
      )
      self.ignore_words = (
          {word.lower() for word in ignore_words}
          if ignore_words is not None
          else set()
      )
  
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 WordReplacementAugmenter object from inherited base classes: WordAugmenter with example: obj = WordReplacementAugmenter(aug_word_min, aug_word_max, aug_word_p, mapping, priority_words, ignore_words)