code: def _validate_kwargs(
      self,
      sampling_strategy: str,
      nlp: Optional["spacy.language.Language"] = None,
      language_model: Optional["LanguageModel"] = None,
      **kwargs: Any,
  ) -> Tuple[dict, dict]:
      # set sampling method
      sampling_strategy = sampling_strategy.strip().lower()
      sampling_strategies = [
          self.SAMPLING_UNKNOWN,
          self.SAMPLING_SIMILARITY,
          self.SAMPLING_LANGUAGE_MODEL,
      ]
  
      # validate sampling method
      if sampling_strategy not in sampling_strategies:
          sampling_strategy = self.SAMPLING_UNKNOWN
          logger.warning(
              f"Sampling method {sampling_strategy} if not valid. "
              f"Using the default value `{self.SAMPLING_UNKNOWN}`"
          )
  
      if sampling_strategy in [
          self.SAMPLING_UNKNOWN,
          self.SAMPLING_SIMILARITY,
      ]:
          if nlp is None:
              raise ValueError(
                  "spaCy model can not be `None` when "
                  f"`sampling_strategy` set to `{sampling_strategy}`."
              )
          # set nlp object
          self.model = load_spacy_lexeme_prob(nlp)
      else:
          if language_model is None:
              raise ValueError(
                  "Language model can not be `None` when "
                  f"`sampling_strategy` set to `{sampling_strategy}`"
              )
          # set language model object
          self.model = language_model
          self.model_class = type(language_model).__name__
  
      # set sampling method
      self.sampling_strategy = sampling_strategy
  
      # get default args
      default_args: dict = self.DEFAULTS[self.sampling_strategy]
      perturb_opts: dict = deepcopy(
          default_args
      )  # contains only the perturbation params
      all_opts = deepcopy(
          default_args
      )  # contains params + some potential incorrect params
  
      # compute common keys
      allowed_keys = set(perturb_opts.keys())
      provided_keys = set(kwargs.keys())
      common_keys = allowed_keys & provided_keys
  
      # incorrect keys
      if len(common_keys) < len(provided_keys):
          incorrect_keys = ", ".join(provided_keys - common_keys)
          logger.warning(
              "The following keys are incorrect: " + incorrect_keys
          )
  
      # update defaults args and all params
      perturb_opts.update({key: kwargs[key] for key in common_keys})
      all_opts.update(kwargs)
      return perturb_opts, all_opts
  
imports: import copy
  import logging
  import string
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import spacy
  from alibi.utils.missing_optional_dependency import import_optional
  from alibi.api.defaults import DEFAULT_DATA_ANCHOR, DEFAULT_META_ANCHOR
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.exceptions import PredictorCallError, PredictorReturnTypeError
  from alibi.utils.wrappers import ArgmaxTransformer
  from .anchor_base import AnchorBaseBeam
  from .anchor_explanation import AnchorExplanation
  from .text_samplers import UnknownSampler, SimilaritySampler, load_spacy_lexeme_prob
label_desc: Use image node_id 2 for calling the AnchorText obj's underlying member method code with example usage: obj._validate_kwargs(sampling_strategy, nlp, language_model) and returns: perturb_opts,  all_opts