class_docstr: Augmenter that replaces words based on a given mapping
class_docstr_tok: ["Augmenter","that","replaces","words","based","on","a","given","mapping"]
code: def __init__(
      self,
      aug_p: float,
      mapping: Optional[Union[str, Dict[str, Any]]],
      max_contraction_length: int = 2,
      seed: Optional[int] = 10,
  ):
      assert (
          max_contraction_length >= 2
      ), "Must set 'max_contraction_length' >= 2"
      self.aug_p = aug_p
      self.contraction_mapping = self.get_mapping(mapping)
      self.max_contraction_length = max_contraction_length
      self.rng = (
          np.random.RandomState(seed) if seed is not None else np.random
      )
  
file_path: AugLy/augly/text/augmenters/contraction.py
imports: import json
  from typing import Any, Dict, List, Optional, Union
  import numpy
  from augly.text.augmenters.utils import detokenize, tokenize
  from augly.utils import pathmgr
label_desc: Use image node_id 1 to create a new ContractionAugmenter object  with example: obj = ContractionAugmenter(aug_p, mapping, max_contraction_length, seed)