code: def get_low_pmi_bigrams(threshold_coef, word_freq_df):
      # type: (float, pd.DataFrame) -> object
      is_bigram = np.array([" " in word for word in word_freq_df.index])
      unigram_freq = word_freq_df[~is_bigram].sum(axis=1)
      bigram_freq = word_freq_df[is_bigram].sum(axis=1)
      bigram_prob = bigram_freq / bigram_freq.sum()
      unigram_prob = unigram_freq / unigram_freq.sum()
  
      def get_pmi(bigram):
          try:
              return np.log(
                  bigram_prob[bigram]
                  / np.product(
                      [unigram_prob[word] for word in bigram.split(" ")]
                  )
              ) / np.log(2)
          except:
              return 0
  
      low_pmi_bigrams = bigram_prob[
          bigram_prob.index.map(get_pmi) < threshold_coef * 2
      ]
      return low_pmi_bigrams
  
file_path: scattertext/scattertext/TermDocMatrixFilter.py
imports: from collections import Counter
  import numpy
  from scattertext.Common import DEFAULT_PMI_THRESHOLD_COEFFICIENT
label_desc: Use image node_id 4 for calling a global function with example usage: get_low_pmi_bigrams(threshold_coef, word_freq_df) and returns: low_pmi_bigrams, unknown, int