docstr: Return a list of ``(text, replaced_words_count, mask)`` tuples with
  n_samples versions of text with some words replaced.
  If a word is replaced, all duplicate words are also replaced
  from the text. By default words are replaced with '', i.e. removed.
docstr_tok: ["Return","a","list","of","``","(","text",",","replaced_words_count",",","mask",")","``","tuples","with","n_samples","versions","of","text","with","some","words","replaced",".","If","a","word","is","replaced",",","all","duplicate","words","are","also","replaced","from","the","text",".","By","default","words","are","replaced","with","``",",","i.e",".","removed","."]
code: def replace_random_tokens_bow(
      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]
  ):
      # type: (...) -> List[Tuple[str, int, np.ndarray]]
      """
      Return a list of ``(text, replaced_words_count, mask)`` tuples with
      n_samples versions of text with some words replaced.
      If a word is replaced, all duplicate words are also replaced
      from the text. By default words are replaced with '', i.e. removed.
      """
      if not self.vocab:
          nomask = np.array([], dtype=int)
          return [("", 0, nomask)] * n_samples
  
      min_replace, max_replace = self._get_min_max(
          min_replace, max_replace, len(self.vocab)
      )
      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:
          tokens_to_replace = set(
              rng.choice(self.vocab, num_to_replace, replace=False)
          )
          idx_to_replace = [
              idx
              for idx, token in enumerate(self.tokens)
              if token in tokens_to_replace
          ]
          mask = indices_to_bool_mask(idx_to_replace, len(self.tokens))
          s = self.split.masked(idx_to_replace, 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 3 for calling the TokenizedText obj's underlying member method code with example usage: obj.replace_random_tokens_bow(n_samples, replacement, random_state, min_replace, max_replace) and returns: res, unknown