def output_words_image(threshold_metric, output_metric, min_words, threshold, vocab, is_functional):
  ind_output = np.argsort(threshold_metric)
  ind_output = ind_output[::-1]
  must_keep1 = threshold_metric[ind_output] >= threshold;
  must_keep2 = np.cumsum(is_functional[ind_output]) < 1+min_words;
  ind_output = [ind for j, ind in enumerate(ind_output) if must_keep1[j] or must_keep2[j]]
  out = [(vocab['words'][ind], output_metric[ind], threshold_metric[ind]) for ind in ind_output]
  return out
dataset/ETHPy150Open s-gupta/visual-concepts/test_model.py/output_words_image/original