docstr: Perturbation functions, swaps random characters with their neighbors
  
  Parameters
  ----------
  string : str
      input string
  typos : int
      number of typos to add
  
  Returns
  -------
  list(string)
      perturbed strings
docstr_tok: ["Perturbation","functions",",","swaps","random","characters","with","their","neighbors","Parameters","--","--","--","--","--","string",":","str","input","string","typos",":","int","number","of","typos","to","add","Returns","--","--","--","-","list","(","string",")","perturbed","strings"]
code: def add_typos(string, typos=1):
      """Perturbation functions, swaps random characters with their neighbors
  
      Parameters
      ----------
      string : str
          input string
      typos : int
          number of typos to add
  
      Returns
      -------
      list(string)
          perturbed strings
  
      """
      string = list(string)
      swaps = np.random.choice(len(string) - 1, typos)
      for swap in swaps:
          tmp = string[swap]
          string[swap] = string[swap + 1]
          string[swap + 1] = tmp
      return "".join(string)
  
imports: import numpy
  import collections
  import re
  import os
  import json
  import pattern
  from pattern.en import tenses
  from .editor import recursive_apply, MunchWithAdd
label_desc: Use image node_id 4 for calling the Perturb obj's underlying member method code with example usage: obj.add_typos(string, typos) and returns: str