code: def delete_chars(
      aug_toks: list[types.AugTok], *, num: int | float = 1
  ) -> list[types.AugTok]:
      """
      Randomly delete a character in randomly-selected words,
      up to ``num`` times or with a probability of ``num``.
  
      Args:
          aug_toks: Sequence of tokens to augment through character deletion.
          num: If int, maximum number of words to modify with a random character deletion;
              if float, probability that a given word will be modified.
  
      Returns:
          New, augmented sequence of tokens.
      """
      _validate_aug_toks(aug_toks)
      cand_idxs = [
          idx
          for idx, aug_tok in enumerate(aug_toks)
          if aug_tok.is_word and len(aug_tok.text) >= 3
      ]
      rand_idxs = set(_select_random_candidates(cand_idxs, num))
      if not rand_idxs:
          return aug_toks[:]
  
      new_aug_toks = []
      for idx, aug_tok in enumerate(aug_toks):
          if idx in rand_idxs:
              rand_char_idx = random.choice(range(len(aug_tok.text)))
              text = "".join(
                  char
                  for char_idx, char in enumerate(aug_tok.text)
                  if char_idx != rand_char_idx
              )
              new_aug_toks.append(
                  types.AugTok(
                      text=text,
                      ws=aug_tok.ws,
                      pos=aug_tok.pos,
                      is_word=aug_tok.is_word,
                      syns=aug_tok.syns,
                  )
              )
          else:
              new_aug_toks.append(aug_tok)
      return new_aug_toks
  
file_path: textacy/src/textacy/augmentation/transforms.py
imports: from __future__ import annotations
  import random
  from typing import Optional
  from cytoolz import itertoolz
  from ..None import errors, types, utils
  from .None import utils
label_desc: Use image node_id 8 for calling a global function with example usage: delete_chars(aug_toks) and returns: new_aug_toks, aug_toks