class_docstr: Replaces words randomly with common misspellings, from a list of common misspellings.
  
  Perturbation example:
  
  **Input:**
      Already, the new product is not available.
  
  **Output:**
      Aready, the new product is not availible.
docstr: Initialize the misspelling perturbation.
  
  Args:
      prob (float): probability between [0,1] of perturbing a word to a
          common misspelling (if we have a common misspelling for the word)
docstr_tok: ["Initialize","the","misspelling","perturbation",".","Args",":","prob","(","float",")",":","probability","between","[","0,1","]","of","perturbing","a","word","to","a","common","misspelling","(","if","we","have","a","common","misspelling","for","the","word",")"]
code: def __init__(self, prob: float):
      """Initialize the misspelling perturbation.
  
      Args:
          prob (float): probability between [0,1] of perturbing a word to a
              common misspelling (if we have a common misspelling for the word)
      """
      self.prob: float = prob
      misspellings_file = (
          Path(__file__).resolve().expanduser().parent
          / "correct_to_misspelling.json"
      )
      with open(misspellings_file, "r") as f:
          self.correct_to_misspelling: Dict[str, List[str]] = json.load(
              f
          )
      self.mispelling_pattern = re.compile(
          r"\b({})\b".format(
              "|".join(self.correct_to_misspelling.keys())
          )
      )
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/augmentations/misspelling_perturbation.py
imports: from dataclasses import dataclass
  import json
  from pathlib import Path
  import re
  from random import Random
  from typing import Dict, List
  from helm.common.general import match_case
  from .perturbation import Perturbation
  from .perturbation_description import PerturbationDescription
label_desc: Use image node_id 1 to create a new MisspellingPerturbation object from inherited base classes: Perturbation with example: obj = MisspellingPerturbation(prob)