class_docstr: Sampler for text data. It randomly removes or replaces tokens from text.
  
  Parameters
  ----------
  token_pattern : str, optional
      Regexp for token matching
  bow : bool, optional
      Sampler could either replace all instances of a given token
      (bow=True, bag of words sampling) or replace just a single token
      (bow=False).
  random_state : integer or numpy.random.RandomState, optional
      random state
  replacement : str
      Defalt value is '' - by default tokens are removed. If you want to
      preserve the total token count set ``replacement`` to a non-empty
      string, e.g. 'UNKN'.
  min_replace : int or float
      A minimum number of tokens to replace. Default is 1, meaning 1 token.
      If this value is float in range [0.0, 1.0], it is used as a ratio.
      More than min_replace tokens could be replaced if group_size > 1.
  max_replace : int or float
      A maximum number of tokens to replace. Default is 1.0, meaning
      all tokens can be replaced. If this value is float in range
      [0.0, 0.1], it is used as a ratio.
  group_size : int
      When group_size > 1, groups of nearby tokens are replaced all
      in once (each token is still replaced with a replacement).
      Default is 1, meaning individual tokens are replaced.
class_docstr_tok: ["Sampler","for","text","data",".","It","randomly","removes","or","replaces","tokens","from","text",".","Parameters","--","--","--","--","--","token_pattern",":","str",",","optional","Regexp","for","token","matching","bow",":","bool",",","optional","Sampler","could","either","replace","all","instances","of","a","given","token","(","bow=True",",","bag","of","words","sampling",")","or","replace","just","a","single","token","(","bow=False",")",".","random_state",":","integer","or","numpy.random.RandomState",",","optional","random","state","replacement",":","str","Defalt","value","is","``","-","by","default","tokens","are","removed",".","If","you","want","to","preserve","the","total","token","count","set","``","replacement","``","to","a","non-empty","string",",","e.g",".","'UNKN","'",".","min_replace",":","int","or","float","A","minimum","number","of","tokens","to","replace",".","Default","is","1",",","meaning","1","token",".","If","this","value","is","float","in","range","[","0.0",",","1.0","]",",","it","is","used","as","a","ratio",".","More","than","min_replace","tokens","could","be","replaced","if","group_size",">","1.","max_replace",":","int","or","float","A","maximum","number","of","tokens","to","replace",".","Default","is","1.0",",","meaning","all","tokens","can","be","replaced",".","If","this","value","is","float","in","range","[","0.0",",","0.1","]",",","it","is","used","as","a","ratio",".","group_size",":","int","When","group_size",">","1",",","groups","of","nearby","tokens","are","replaced","all","in","once","(","each","token","is","still","replaced","with","a","replacement",")",".","Default","is","1",",","meaning","individual","tokens","are","replaced","."]
code: def sample_near_with_mask(
      self,
      doc,  # type: Union[TokenizedText, str]
      n_samples=1,  # type: int
  ):
      # type: (...) -> Tuple[List[str], np.ndarray, np.ndarray, TokenizedText]
      if not isinstance(doc, TokenizedText):
          doc = TokenizedText(doc, token_pattern=self.token_pattern)
  
      gen_samples = partial(
          generate_samples,
          doc,
          n_samples=n_samples,
          replacement=self.replacement,
          min_replace=self.min_replace,
          max_replace=self.max_replace,
          group_size=self.group_size,
          random_state=self.rng_,
      )
      docs, similarity, mask = gen_samples(bow=self.bow)
      return docs, similarity, mask, doc
  
imports: from __future__ import absolute_import
  import abc
  from functools import partial
  from typing import List, Tuple, Any, Union, Dict, Optional
  import six
  import numpy
  from scipy.stats import itemfreq
  from sklearn.base import BaseEstimator, clone
  from sklearn.neighbors import KernelDensity
  from sklearn.metrics import pairwise_distances
  from sklearn.model_selection import GridSearchCV, KFold
  from sklearn.utils import check_random_state
  from eli5.utils import vstack
  from eli5.lime.utils import rbf
  from .textutils import generate_samples, DEFAULT_TOKEN_PATTERN, TokenizedText
label_desc: Use image node_id 3 for calling the MaskingTextSampler obj's underlying member method code with example usage: obj.sample_near_with_mask(doc, n_samples) and returns: docs,  similarity,  mask,  doc