code: public static <TERM> Map<TERM, Double> tfIdf(Map<TERM, Double> tf, Map<TERM, Double> idf,
                                                   Normalization normalization)
      {
          Map<TERM, Double> tfIdf = new HashMap<TERM, Double>();
          for (TERM term : tf.keySet())
          {
              Double TF = tf.get(term);
              if (TF == null) TF = 1.;
              Double IDF = idf.get(term);
              if (IDF == null) IDF = 1.;
              tfIdf.put(term, TF * IDF);
          }
          if (normalization == Normalization.COSINE)
          {
              double n = 0.0;
              for (double x : tfIdf.values())
              {
                  n += x * x;
              }
              n = Math.sqrt(n);
  
              for (TERM term : tfIdf.keySet())
              {
                  tfIdf.put(term, tfIdf.get(term) / n);
              }
          }
          return tfIdf;
      }
docs: 计算文档的tf-idf
  
  @param tf            词频
  @param idf           倒排频率
  @param normalization 正规化
  @param <TERM>        词语类型
  @return 一个词语->tf-idf的Map