class_docstr: Augmenter that replaces words with typos. You can specify a typo_type: charmix, which
  does a combination of character-level modifications (delete, insert, substitute, &
  swap); keyboard, which swaps characters which those close to each other on the QWERTY
  keyboard; misspelling, which replaces words with misspellings defined in a dictionary
  file; or all, which will apply a random combination of all 4
class_docstr_tok: ["Augmenter","that","replaces","words","with","typos",".","You","can","specify","a","typo_type",":","charmix",",","which","does","a","combination","of","character-level","modifications","(","delete",",","insert",",","substitute",",","&","swap",")",";","keyboard",",","which","swaps","characters","which","those","close","to","each","other","on","the","QWERTY","keyboard",";","misspelling",",","which","replaces","words","with","misspellings","defined","in","a","dictionary","file",";","or","all",",","which","will","apply","a","random","combination","of","all","4"]
code: def __init__(
      self,
      min_char: int,
      aug_char_min: int,
      aug_char_max: int,
      aug_char_p: float,
      aug_word_min: int,
      aug_word_max: int,
      aug_word_p: float,
      typo_type: str,
      misspelling_dict_path: Optional[str],
      max_typo_length: int,
      priority_words: Optional[List[str]],
  ):
      validate_augmenter_params(
          aug_char_min,
          aug_char_max,
          aug_char_p,
          aug_word_min,
          aug_word_max,
          aug_word_p,
      )
  
      assert typo_type in [
          "all",
          "charmix",
          "keyboard",
          "misspelling",
      ], "Typo type must be one of: all, charmix, keyboard, misspelling"
  
      super().__init__(
          action=Action.SUBSTITUTE,
          aug_min=aug_word_min,
          aug_max=aug_word_max,
          aug_p=aug_word_p,
      )
  
      self.augmenters, self.model = [], None
      if typo_type in ["all", "charmix"]:
          for action in [
              Action.DELETE,
              Action.INSERT,
              Action.SUBSTITUTE,
              Action.SWAP,
          ]:
              self.augmenters.append(
                  RandomCharAug(
                      action=action,
                      min_char=min_char,
                      aug_char_min=aug_char_min,
                      aug_char_max=aug_char_max,
                      aug_char_p=aug_char_p,
                      reverse_tokenizer=detokenize,
                      tokenizer=tokenize,
                  ),
              )
  
      if typo_type in ["all", "keyboard"]:
          self.augmenters.append(
              KeyboardAug(
                  min_char=min_char,
                  aug_char_min=aug_char_min,
                  aug_char_max=aug_char_max,
                  aug_char_p=aug_char_p,
                  include_upper_case=True,
                  reverse_tokenizer=detokenize,
                  tokenizer=tokenize,
              ),
          )
  
      if typo_type in ["all", "misspelling"]:
          assert (
              misspelling_dict_path is not None
          ), "'misspelling_dict_path' must be provided if 'typo_type' is 'all' or 'misspelling'"
          assert max_typo_length >= 1, "Must set 'max_typo_length' >= 1"
          self.max_typo_length = max_typo_length
          self.model = self.get_model(misspelling_dict_path)
      else:
          self.max_typo_length = 1
  
      self.priority_words = (
          set(priority_words)
          if priority_words is not None
          else priority_words
      )
  
file_path: AugLy/augly/text/augmenters/typo.py
imports: import json
  from typing import List, Optional
  from augly.text.augmenters.utils import detokenize, get_aug_idxes, tokenize, validate_augmenter_params
  from augly.utils import pathmgr
  from augly.utils.libsndfile import install_libsndfile
  from nlpaug.augmenter.char import KeyboardAug, RandomCharAug
  from nlpaug.augmenter.word import WordAugmenter
  from nlpaug.util import Action, Method
label_desc: Use image node_id 1 to create a new TypoAugmenter object from inherited base classes: WordAugmenter with example: obj = TypoAugmenter(min_char, aug_char_min, aug_char_max, aug_char_p, aug_word_min, aug_word_max, aug_word_p, typo_type, misspelling_dict_path, max_typo_length, priority_words)