code: def get_minority_keys(freqs, min_ratio):
      """Remove keys that are too infrequent relative to a main sense."""
      by_word = defaultdict(list)
      for key, freq in freqs.items():
          try:
              term, sense = split_key(key)
          except ValueError:
              continue
          if freq:
              by_word[term.lower()].append((freq, key))
      discarded = []
      for values in by_word.values():
          if len(values) >= 2:
              values.sort(reverse=True)
              freq1, key1 = values[0]
              for freq2, key2 in values[1:]:
                  ratio = freq2 / freq1
                  if ratio < min_ratio:
                      discarded.append(key2)
      return discarded
  
file_path: sense2vec/scripts/05_export.py
imports: from collections import OrderedDict, defaultdict
  from sense2vec import Sense2Vec
  from sense2vec.util import split_key, cosine_similarity
  from pathlib import Path
  from wasabi import msg
  import numpy
  import typer
label_desc: Use image node_id 4 for calling a global function with example usage: get_minority_keys(freqs, min_ratio) and returns: discarded