class_docstr: bla
class_docstr_tok: ["bla"]
code: def as_html(self, exp):
      predict_proba = np.zeros(len(self.class_names))
      exp["prediction"] = int(exp["prediction"])
      predict_proba[exp["prediction"]] = 1
      predict_proba = list(predict_proba)
  
      def jsonize(x):
          return json.dumps(x)
  
      this_dir, _ = os.path.split(__file__)
      bundle = open(
          os.path.join(this_dir, "bundle.js"), encoding="utf8"
      ).read()
      random_id = "top_div" + id_generator()
  
      example_obj = []
  
      def process_examples(examples, idx):
          idxs = exp["feature"][: idx + 1]
          out_dict = {}
          new_names = {
              "covered_true": "coveredTrue",
              "covered_false": "coveredFalse",
              "covered": "covered",
          }
          for name, new in new_names.items():
              ex = [x[0] for x in examples[name]]
              out = []
              for e in ex:
                  processed = self.nlp(str(e))
                  raw_indexes = [
                      (
                          processed[i].text,
                          processed[i].idx,
                          exp["prediction"],
                      )
                      for i in idxs
                  ]
                  out.append({"text": e, "rawIndexes": raw_indexes})
              out_dict[new] = out
          return out_dict
  
      example_obj = []
      for i, examples in enumerate(exp["examples"]):
          example_obj.append(process_examples(examples, i))
  
      explanation = {
          "names": exp["names"],
          "certainties": exp["precision"]
          if len(exp["precision"])
          else [exp["all_precision"]],
          "supports": exp["coverage"],
          "allPrecision": exp["all_precision"],
          "examples": example_obj,
      }
      processed = self.nlp(exp["instance"])
      raw_indexes = [
          (processed[i].text, processed[i].idx, exp["prediction"])
          for i in exp["feature"]
      ]
      raw_data = {"text": exp["instance"], "rawIndexes": raw_indexes}
      jsonize(raw_indexes)
  
      out = (
          """<html>
          <meta http-equiv="content-type" content="text/html; charset=UTF8">
          <head><script>%s </script></head><body>"""
          % bundle
      )
      out += """
          <div id="{random_id}" />
          <script>
              div = d3.select("#{random_id}");
              lime.RenderExplanationFrame(div,{label_names}, {predict_proba},
              {true_class}, {explanation}, {raw_data}, "text", "anchor");
          </script>""".format(
          random_id=random_id,
          label_names=jsonize(self.class_names),
          predict_proba=jsonize(list(predict_proba)),
          true_class=jsonize(False),
          explanation=jsonize(explanation),
          raw_data=jsonize(raw_data),
      )
      out += "</body></html>"
      return out
  
imports: from .None import utils
  from .None import anchor_base
  from .None import anchor_explanation
  import numpy
  import json
  import os
  import string
  import sys
  from io import open
  import numpy
label_desc: Use image node_id 4 for calling the AnchorText obj's underlying member method code with example usage: obj.as_html(exp) and returns: out, json, out_dict