code: def _cal_pmi(W_ij, W, word_freq_i, word_freq_j):
      r"""
      params: w_ij:为词语i,j的共现词频
              w:文本数量
              word_freq_i: 词语i的词频
              word_freq_j: 词语j的词频
      return: 词语i，j的tfidf值
      """
      p_i = word_freq_i / W
      p_j = word_freq_j / W
      p_i_j = W_ij / W
      pmi = math.log(p_i_j / (p_i * p_j))
  
      return pmi
  
imports: from collections import defaultdict
  import itertools
  import math
  import numpy
  from ..data_bundle import DataBundle
  from ..loader.classification import MRLoader, OhsumedLoader, R52Loader, R8Loader, NG20Loader
  from fastNLP.core.utils import f_rich_progress
label_desc: Use image node_id 2 for calling a global function with example usage: _cal_pmi(W_ij, W, word_freq_i, word_freq_j) and returns: pmi