def _get_atoms_below_count(examples, get_atoms_fn, atom_count):
  """Return set of atoms that appear <= atom_count times across all examples."""
  atoms_to_count = _get_atoms_to_count(examples, get_atoms_fn)
  atoms = set(
      [atom for atom, count in atoms_to_count.items() if count <= atom_count])
  return atoms
Return set of atoms that appear <= atom_count times across all examples.
language/compgen/nqg/tasks/mcd_utils.py