docstr: Fill in the masked tokens with language model.
  
  Parameters
  ----------
  raw
      Array of mask templates.
  data
      Binary mask having 0 where the word was masked.
  num_samples
      Number of samples to be drawn.
  top_n:
      Use the top n words when sampling.
  batch_size_lm:
      Batch size used for language model.
  filling
      Method to fill masked words. Either ``'parallel'`` or ``'autoregressive'``.
  **kwargs
      Other paremeters to be passed to other methods.
  
  Returns
  -------
  raw
      Array containing `num_samples` elements. Each element is a perturbed sentence.
docstr_tok: ["Fill","in","the","masked","tokens","with","language","model",".","Parameters","--","--","--","--","--","raw","Array","of","mask","templates",".","data","Binary","mask","having","0","where","the","word","was","masked",".","num_samples","Number","of","samples","to","be","drawn",".","top_n",":","Use","the","top","n","words","when","sampling",".","batch_size_lm",":","Batch","size","used","for","language","model",".","filling","Method","to","fill","masked","words",".","Either","``","'parallel","'","``","or","``","'autoregressive","'","``",".","*","*","kwargs","Other","paremeters","to","be","passed","to","other","methods",".","Returns","--","--","--","-","raw","Array","containing","`","num_samples","`","elements",".","Each","element","is","a","perturbed","sentence","."]
code: def fill_mask(
      self,
      raw: np.ndarray,
      data: np.ndarray,
      num_samples: int,
      top_n: int = 100,
      batch_size_lm: int = 32,
      filling: str = "parallel",
      **kwargs,
  ) -> Tuple[np.ndarray, np.ndarray]:
      """
      Fill in the masked tokens with language model.
  
      Parameters
      ----------
      raw
          Array of mask templates.
      data
          Binary mask having 0 where the word was masked.
      num_samples
          Number of samples to be drawn.
      top_n:
          Use the top n words when sampling.
      batch_size_lm:
          Batch size used for language model.
      filling
          Method to fill masked words. Either ``'parallel'`` or ``'autoregressive'``.
      **kwargs
          Other paremeters to be passed to other methods.
  
      Returns
      -------
      raw
          Array containing `num_samples` elements. Each element is a perturbed sentence.
      """
      # chose the perturbation function
      perturb_func = (
          self._perturb_instances_parallel
          if filling == self.FILLING_PARALLEL
          else self._perturb_instance_ar
      )
  
      # perturb instances
      tokens, data = perturb_func(
          raw=raw,
          data=data,
          num_samples=num_samples,
          batch_size_lm=batch_size_lm,
          top_n=top_n,
          **kwargs,
      )
  
      # decode the tokens and remove special characters as <pad>, <cls> etc.
      raw = self.model.tokenizer.batch_decode(
          tokens, skip_special_tokens=True
      )
      return np.array(raw), data
  
imports: import string
  from functools import partial
  from typing import Dict, List, Optional, Tuple
  import numpy
  import tensorflow
  from alibi.utils.lang_model import LanguageModel
  from alibi.explainers.anchors.text_samplers import AnchorTextSampler
label_desc: Use image node_id 9 for calling the LanguageModelSampler obj's underlying member method code with example usage: obj.fill_mask(raw, data, num_samples, top_n, batch_size_lm, filling) and returns: np,  data