docs: def generate_phrase_detection_function(cls, min_token_count, max_phrases, exclude_ngram_filter=None):
          """
          This is a factory function for generating a phrase detection function
          :param cls: the class
          :param min_token_count: tokens that appear less than this will be ignored in the phrase detection function
          :param max_phrases: the maximum number of phrases to return in the phrase detection function
          :param exclude_ngram_filter: if defined, this function filters ngrams in the phrase detection function
          :return:
          """
          #if exclude_ngram_filter is None and cls.exclude_ngram_filter:
          #    exclude_ngram_filter = cls.exclude_ngram_filter
  
          def phrase_detector(tokens):
              #if not isinstance(tokens, list):
              #    tokens = list(tokens)
              collocation_finder = nltk.collocations.BigramCollocationFinder.from_words(tokens)
              collocation_finder.apply_freq_filter(min_token_count)  # @TODO remove bottom X%, and tune on X
              if exclude_ngram_filter:
                  collocation_finder.apply_ngram_filter(exclude_ngram_filter)
              bigram_measures = nltk.collocations.BigramAssocMeasures()
              phrases = collocation_finder.nbest(bigram_measures.chi_sq, max_phrases)
              return phrases
  
          return phrase_detector