code: def _save_AnchorText(
      explainer: "AnchorText", path: Union[str, os.PathLike]
  ) -> None:
      from alibi.explainers import AnchorText
  
      model = explainer.model
      predictor = explainer.predictor
      perturbation = explainer.perturbation
      sampling_strategy = explainer.sampling_strategy
  
      nlp_sampling = [
          AnchorText.SAMPLING_UNKNOWN,
          AnchorText.SAMPLING_SIMILARITY,
      ]
      dir_name = (
          "nlp"
          if sampling_strategy in nlp_sampling
          else "language_model"
      )
      model.to_disk(Path(path, dir_name))
  
      explainer.model = None  # type: ignore[assignment]
      explainer.predictor = None  # type: ignore[assignment]
      explainer.perturbation = None
  
      with open(Path(path, "explainer.dill"), "wb") as f:
          dill.dump(explainer, f, recurse=True)
  
      explainer.model = model
      explainer.predictor = predictor
      explainer.perturbation = perturbation
  
imports: import copy
  import json
  import numbers
  import os
  from pathlib import Path
  import sys
  from typing import Callable, TYPE_CHECKING, Union
  import warnings
  import dill
  import numpy
  from alibi.version import __version__
label_desc: Use image node_id 10 for calling a global function with example usage: _save_AnchorText(explainer, path) without return types