code: def get_javascript(self):
      d = {}
      for category, cat_df in self.rank_df.assign(
          Frequency=lambda df: df.Frequency.astype(int)
      ).groupby("Category"):
          cat_d = {}
          for _, row in cat_df.iterrows():
              cat_d[row["Term"]] = {
                  "Rank": row["Rank"],
                  "Freq": row["Frequency"],
              }
          d[category] = cat_d
      js = "categoryFrequency = " + json.dumps(d) + "; \n\n"
      cat_dict = dict(
          self.__get_cat_df(display_df=self.__get_display_df())
          .set_index("Category")["CategoryNum"]
          .astype(str)
      )
      js += (
          """
          Array.from(document.querySelectorAll('.clickabletd')).map(
              function (node) {
                  node.addEventListener('mouseenter', mouseEnterNode);
                  node.addEventListener('mouseleave', mouseLeaveNode);    
                  node.addEventListener('click', clickNode);
              }
          )
          
          function clickNode() {
              //document.querySelectorAll(".dotgraph")
              //    .forEach(node => node.style.display = 'none');
  
              //var term = Array.prototype.filter
              //    .call(this.children, (x => x.tagName === "span"))[0].textContent;
  
              //plotInterface.handleSearchTerm(term, true);
              
              
          }
  
          function mouseEnterNode(event) {
              //console.log("THIS"); console.log(this)
              var term = this.children[0].textContent;
              plotInterface.showTooltipSimple(term);
              var clickableTds = document.getElementsByClassName('clickabletd');
              
              for(var i = 0; i < clickableTds.length; i++) {
                  var td = clickableTds[i];
                  if(Object.entries(td.children).length > 0 && td.children[0].textContent == term) 
                      td.style.backgroundColor = "#FFAAAA";
                      
              }
              
              var termStats = []; 
              Object.keys(categoryFrequency).map(function(cat) {
                  termStats[cat] = [
                      categoryFrequency[cat][term]['Rank'], 
                      Object.values(categoryFrequency[cat]).map(y=>y.Rank).reduce((a,b)=>Math.max(a,b), 0),
                      categoryFrequency[cat][term]['Freq'],
                      Object.keys(categoryFrequency[cat]).length
                  ]
              });
              
              Object.entries(getCatNumToCat()).flatMap(
                  function(kv) {
                      if(false) {
                          var td = document.getElementById('clickabletd-' + kv[1]);
                          var termStat = termStats[kv[0]];
                          console.log(termStat)
                          if(termStat[0] >= """
          + str(self.num_rows)
          + ''') { 
                              td.style.tableLayout = 'fixed';
                              //td.style.wordWrap = 'break-word';
                              td.style.flexWrap =  'wrap';
                              //td.style.backgroundColor = "#FFAAAA";
                              td.style.fontSize = "'''
          + str(self.min_font_size)
          + '''px";  
                              td.textContent = (termStat[2]) + " occs; rank: " + (termStat[0] + 1);
                          } else {
                              td.style.tableLayout = 'fixed';
                              //td.style.wordWrap = 'break-word';
                              td.style.flexWrap =  'wrap';
                              td.style.backgroundColor = "#FFFFFF";
                              td.style.fontSize = "'''
          + str(self.min_font_size)
          + '''px";  
                              td.textContent = (termStat[2]) + " occs; rank: " + (termStat[0] + 1);
                          }
                      }
                  }
              );
              
          }
          
          function mouseLeaveNode(event) {
              plotInterface.tooltip.transition().style('opacity', 0)
              var clickableTds = document.getElementsByClassName('clickabletd');            
              for(var i = 0; i < clickableTds.length; i++) 
                  clickableTds[i].style.backgroundColor = "#FFFFFF";
                  
              Object.entries(getCatNumToCat()).flatMap(
                  function(kv) {
                      if(false) {
                          var td = document.getElementById('clickabletd-' + kv[1]);
                  
                          td.style.tableLayout = 'fixed';
                          //td.style.wordWrap = 'break-word';
                          td.style.flexWrap =  'wrap';
                          td.style.backgroundColor = "#FFFFFF";
                          td.style.fontSize = "'''
          + str(self.min_font_size)
          + """px";  
                          //td.innerHtml = '&nbsp;'.repeat(27);
                          td.textContent = '';
                      }
                  }
              )                
          }
          
          function getCatNumToCat() { return """
          + json.dumps(cat_dict)
          + """}"""
      )
      return js
  
file_path: scattertext/scattertext/categorytable/category_table_maker.py
imports: import json
  import types
  from _bisect import bisect_left
  from typing import Optional, Union, Callable
  import numpy
  import pandas
  from scattertext.TermDocMatrix import TermDocMatrix
  from scattertext.all_category_scorers.gmean_l2_freq_associator import AllCategoryScorerGMeanL2
  from scattertext.all_category_scorers.all_category_scorer import AllCategoryScorer
  from scattertext.graphs.ComponentDiGraphHTMLRenderer import GraphRenderer
  from scattertext.viz.HTMLSemioticSquareViz import ClickableTerms
label_desc: Use image node_id 6 for calling the CategoryTableMaker obj's underlying member method code with example usage: obj.get_javascript() and returns: js