code: def idx_to_words(ls, words):
      """Given a list generated from cluster_idx, return a list that contains
      sub-list (the first element being the idx, and the second element being the
      words corresponding to the idx)"""
  
      output = []
      for cluster in ls:
          word = words[cluster[0]]
          for idx in cluster[1:]:
              word = " ".join([word, words[idx]])
          output.append([cluster, word])
      return output
  
file_path: TextAttack/textattack/transformations/word_swaps/word_swap_change_number.py
imports: import more_itertools
  from num2words import num2words
  import numpy
  from word2number import w2n
  from .word_swap import WordSwap
label_desc: Use image node_id 1 for calling a global function with example usage: idx_to_words(ls, words) and returns: output