code: def simulate_typos(
      texts: Union[str, List[str]],
      aug_char_p: float = 0.3,
      aug_word_p: float = 0.3,
      min_char: int = 2,
      aug_char_min: int = 1,
      aug_char_max: int = 1,
      aug_word_min: int = 1,
      aug_word_max: int = 1000,
      n: int = 1,
      typo_type: str = "all",
      misspelling_dict_path: Optional[
          str
      ] = MISSPELLING_DICTIONARY_PATH,
      max_typo_length: int = 1,
      priority_words: Optional[List[str]] = None,
      metadata: Optional[List[Dict[str, Any]]] = None,
  ) -> Union[str, List[str]]:
      """
      Simulates typos in each text using misspellings, keyboard distance, and swapping.
      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
  
      @param texts: a string or a list of text documents to be augmented
  
      @param aug_char_p: probability of letters to be replaced in each word;
          This is only applicable for keyboard distance and swapping
  
      @param aug_word_p: probability of words to be augmented
  
      @param min_char: minimum # of letters in a word for a valid augmentation;
          This is only applicable for keyboard distance and swapping
  
      @param aug_char_min: minimum # of letters to be replaced/swapped in each word;
          This is only applicable for keyboard distance and swapping
  
      @param aug_char_max: maximum # of letters to be replaced/swapped in each word;
          This is only applicable for keyboard distance and swapping
  
      @param aug_word_min: minimum # of words to be augmented
  
      @param aug_word_max: maximum # of words to be augmented
  
      @param n: number of augmentations to be performed for each text
  
      @param typo_type: the type of typos to apply to the text; valid values are
          "misspelling", "keyboard", "charmix", or "all"
  
      @param misspelling_dict_path: iopath uri where the misspelling dictionary is stored;
          must be specified if typo_type is "misspelling" or "all", but otherwise can be
          None
  
      @param max_typo_length: the words in the misspelling dictionary will be checked for
          matches in the mapping up to this length; i.e. if 'max_typo_length' is 3 then
          every substring of 2 *and* 3 words will be checked
  
      @param priority_words: list of target words that the augmenter should
          prioritize to augment first
  
      @param metadata: if set to be a list, metadata about the function execution
          including its name, the source & dest length, etc. will be appended to
          the inputted list. If set to None, no metadata will be appended or returned
  
      @returns: the list of augmented text documents
      """
      func_kwargs = txtutils.get_func_kwargs(metadata, locals())
  
      typo_aug = a.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,
      )
      aug_texts = typo_aug.augment(texts, n)
  
      txtutils.get_metadata(
          metadata=metadata,
          function_name="simulate_typos",
          aug_texts=aug_texts,
          **func_kwargs,
      )
  
      return aug_texts
  
imports: from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Union
  from augly.text import augmenters, utils
  from augly.utils import CONTRACTIONS_MAPPING, FUN_FONTS_PATH, GENDERED_WORDS_MAPPING, MISSPELLING_DICTIONARY_PATH, UNICODE_MAPPING_PATH
label_desc: Use image node_id 17 for calling a global function with example usage: simulate_typos(texts, aug_char_p, aug_word_p, min_char, aug_char_min, aug_char_max, aug_word_min, aug_word_max, n, typo_type, misspelling_dict_path, max_typo_length, priority_words, metadata) and returns: aug_texts