code: def _prepare_unigram_set(
      unigrams: Collection[str], kenlm_model: "kenlm.Model"
  ) -> Set[str]:
      """Filter unigrams down to vocabulary that exists in kenlm_model.
  
      Taken from: https://github.com/kensho-technologies/pyctcdecode
  
      Arguments
      ---------
      unigrams : list
          List of unigrams.
      kenlm_model : kenlm.Model
          Kenlm model.
  
      Returns
      -------
      unigram_set : set
          Set of unigrams.
      """
      if len(unigrams) < 1000:
          logger.warning(
              "Only %s unigrams passed as vocabulary. Is this small or artificial data?",
              len(unigrams),
          )
      unigram_set = set(unigrams)
      unigram_set = set([t for t in unigram_set if t in kenlm_model])
      retained_fraction = (
          1.0
          if len(unigrams) == 0
          else len(unigram_set) / len(unigrams)
      )
      if retained_fraction < 0.1:
          logger.warning(
              "Only %s%% of unigrams in vocabulary found in kenlm model-- this might mean that your "
              "vocabulary and language model are incompatible. Is this intentional?",
              round(retained_fraction * 100, 1),
          )
      return unigram_set
  
file_path: speechbrain/speechbrain/decoders/language_model.py
imports: import logging
  from typing import Collection, Optional, Set, Tuple, cast
  from pygtrie import CharTrie
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: _prepare_unigram_set(unigrams, kenlm_model) and returns: unigram_set