code: def main():
      parser = ArgumentParser()
      parser.add_argument(
          "--source", type=str, required=True, help="Input file"
      )
      parser.add_argument(
          "--target", type=str, required=True, help="Output file"
      )
      parser.add_argument(
          "--p_switch_near_letters_order",
          type=float,
          default=0.0,
          help="Probability of switching two consecutive letters in a word",
      )
      parser.add_argument(
          "--p_drop_letter",
          type=float,
          default=0.0,
          help="Probability of dropping a letter in a word",
      )
      # AugLy
      parser.add_argument(
          "--p_augly",
          type=float,
          default=0.0,
          help="Probability of augly to apply a transformation (per word)",
      )
  
      args = parser.parse_args()
  
      if (args.p_augly > 0) and (txtaugs is None):
          raise ImportError(
              "Cannot use AugLy, module failed to import. Did you install it? (pip install augly)"
          )
  
      # collect ops
      ops = []
      if args.p_switch_near_letters_order > 0:
          ops.append(
              lambda w: aug_switch_near_letters(
                  w, p=args.p_switch_near_letters_order
              )
          )
      if args.p_drop_letter > 0:
          ops.append(lambda w: aug_drop_letter(w, p=args.p_drop_letter))
  
      # apply ops
      with open(args.target, "w") as target_f:
          for line in open(args.source).readlines():
              line = line.strip()
              words = line.split(" ")
              for op in ops:
                  words = list(map(op, words))
              # clean double spaces from dropped words
              line = " ".join(words).replace("  ", " ")
  
              if args.p_augly > 0:
                  line = txtaugs.simulate_typos(
                      [line],
                      aug_char_p=args.p_augly,
                      aug_word_p=args.p_augly,
                      aug_char_min=0,
                      aug_word_min=0,
                  )[0]
  
              target_f.write(line + "\n")
  
imports: from argparse import ArgumentParser
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types