docstr: Add feature names to explanation dictionary.
  
  Parameters
  ----------
  explanation
      Dict with anchors and additional metadata.
code: def add_names_to_exp(self, explanation: dict) -> None:
      """
      Add feature names to explanation dictionary.
  
      Parameters
      ----------
      explanation
          Dict with anchors and additional metadata.
      """
  
      anchor_idxs = explanation["feature"]
      ordinal_ranges = {
          self.enc2feat_idx[idx]: [float("-inf"), float("inf")]
          for idx in anchor_idxs
      }
      explanation["feature"] = list(ordinal_ranges.keys())
      explanation["names"] = []
  
      for idx in set(anchor_idxs) - self.cat_lookup.keys():
          feat_id = self.enc2feat_idx[idx]  # feature col. id
          if (
              0 in self.ord_lookup[idx]
          ):  # tells if the feature in X falls in a higher or lower bin
              ordinal_ranges[feat_id][1] = min(
                  ordinal_ranges[feat_id][1],
                  max(list(self.ord_lookup[idx])),
              )
          else:
              ordinal_ranges[feat_id][0] = max(
                  ordinal_ranges[feat_id][0],
                  min(list(self.ord_lookup[idx])) - 1,
              )
  
      handled: Set[int] = set()
      for idx in anchor_idxs:
          feat_id = self.enc2feat_idx[idx]
          if idx in self.cat_lookup:
              v = int(self.cat_lookup[idx])
              fname = "%s = " % self.feature_names[feat_id]
              if feat_id in self.feature_values:
                  v = int(v)
                  if (
                      "<" in self.feature_values[feat_id][v]
                      or ">" in self.feature_values[feat_id][v]
                  ):
                      fname = ""
                  fname = "%s%s" % (
                      fname,
                      self.feature_values[feat_id][v],
                  )
              else:
                  fname = "%s%.2f" % (fname, v)
          else:
              if feat_id in handled:
                  continue
              geq, leq = ordinal_ranges[feat_id]
              fname = ""
              geq_val = ""
              leq_val = ""
              if geq > float("-inf"):
                  if geq == len(self.feature_values[feat_id]) - 1:
                      geq = geq - 1
                  name = self.feature_values[feat_id][int(geq) + 1]
                  if "<" in name:
                      geq_val = name.split()[0]
                  elif ">" in name:
                      geq_val = name.split()[-1]
              if leq < float("inf"):
                  name = self.feature_values[feat_id][int(leq)]
                  if leq == 0:
                      leq_val = name.split()[-1]
                  elif "<" in name:
                      leq_val = name.split()[-1]
              if leq_val and geq_val:
                  fname = "%s < %s <= %s" % (
                      geq_val,
                      self.feature_names[feat_id],
                      leq_val,
                  )
              elif leq_val:
                  fname = "%s <= %s" % (
                      self.feature_names[feat_id],
                      leq_val,
                  )
              elif geq_val:
                  fname = "%s > %s" % (
                      self.feature_names[feat_id],
                      geq_val,
                  )
              handled.add(feat_id)
          explanation["names"].append(fname)
  
imports: import copy
  from collections import OrderedDict, defaultdict
  from itertools import accumulate
  from typing import Any, Callable, DefaultDict, Dict, List, Optional, Set, Tuple, Type, Union
  import numpy
  from alibi.api.defaults import DEFAULT_DATA_ANCHOR, DEFAULT_META_ANCHOR
  from alibi.api.interfaces import Explainer, Explanation, FitMixin
  from alibi.exceptions import NotFittedError, PredictorCallError, PredictorReturnTypeError
  from alibi.utils.discretizer import Discretizer
  from alibi.utils.mapping import ohe_to_ord, ord_to_ohe
  from alibi.utils.wrappers import ArgmaxTransformer
  from .anchor_base import AnchorBaseBeam
  from .anchor_explanation import AnchorExplanation
label_desc: Use image node_id 6 for calling the AnchorTabular obj's underlying member method code with example usage: obj.add_names_to_exp(explanation) without return types