docstr: Return a list of ``(text, replaced_count, mask)``
  tuples with n_samples versions of text with some words replaced.
  By default words are replaced with '', i.e. removed.
docstr_tok: ["Return","a","list","of","``","(","text",",","replaced_count",",","mask",")","``","tuples","with","n_samples","versions","of","text","with","some","words","replaced",".","By","default","words","are","replaced","with","``",",","i.e",".","removed","."]
code: def replace_random_tokens(
      self,
      n_samples,  # type: int
      replacement="",  # type: str
      random_state=None,
      min_replace=1,  # type: Union[int, float]
      max_replace=1.0,  # type: Union[int, float]
      group_size=1,  # type: int
  ):
      # type: (...) -> List[Tuple[str, int, np.ndarray]]
      """
      Return a list of ``(text, replaced_count, mask)``
      tuples with n_samples versions of text with some words replaced.
      By default words are replaced with '', i.e. removed.
      """
      n_tokens = len(self.tokens)
      indices = np.arange(n_tokens)
      if not n_tokens:
          nomask = np.array([], dtype=int)
          return [("", 0, nomask)] * n_samples
  
      min_replace, max_replace = self._get_min_max(
          min_replace, max_replace, n_tokens
      )
      rng = check_random_state(random_state)
      replace_sizes = rng.randint(
          low=min_replace, high=max_replace + 1, size=n_samples
      )
      res = []
      for num_to_replace in replace_sizes:
          idx_to_replace = rng.choice(
              indices, num_to_replace, replace=False
          )
          idx_to_replace = np.array(
              [idx_to_replace]
              + [
                  idx_to_replace + shift
                  for shift in range(1, group_size)
              ]
          ).ravel()
          padded_size = n_tokens + group_size - 1
          mask = indices_to_bool_mask(idx_to_replace, padded_size)[
              :n_tokens
          ]
          s = self.split.masked(mask, replacement)
          res.append((s.text, num_to_replace, mask))
      return res
  
imports: from __future__ import absolute_import
  import re
  import math
  from typing import List, Tuple, Union, Optional
  import numpy
  from sklearn.utils import check_random_state
  from eli5.utils import indices_to_bool_mask, vstack
label_desc: Use image node_id 2 for calling the TokenizedText obj's underlying member method code with example usage: obj.replace_random_tokens(n_samples, replacement, random_state, min_replace, max_replace, group_size) and returns: res, unknown