docstr: Initialize unknown sampler. This sampler replaces word with the `UNK` token.
  
  Parameters
  ----------
  nlp
      `spaCy` object.
  perturb_opts
      Perturbation options.
docstr_tok: ["Initialize","unknown","sampler",".","This","sampler","replaces","word","with","the","`","UNK","`","token",".","Parameters","--","--","--","--","--","nlp","`","spaCy","`","object",".","perturb_opts","Perturbation","options","."]
code: def __init__(
      self, nlp: "spacy.language.Language", perturb_opts: Dict
  ):
      """
      Initialize unknown sampler. This sampler replaces word with the `UNK` token.
  
      Parameters
      ----------
      nlp
          `spaCy` object.
      perturb_opts
          Perturbation options.
      """
      super().__init__()
  
      # set nlp and perturbation options
      self.nlp = load_spacy_lexeme_prob(nlp)
      self.perturb_opts: Union[Dict, None] = perturb_opts
  
      # define buffer for word, punctuation and position
      self.words: List = []
      self.punctuation: List = []
      self.positions: List = []
  
imports: import logging
  from abc import abstractmethod
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
  import numpy
  import spacy
label_desc: Use image node_id 1 to create a new UnknownSampler object from inherited base classes: AnchorTextSampler with example: obj = UnknownSampler(nlp, perturb_opts)