APISonar


edu.stanford.nlp.math.SloppyMath.log

> edu > stanford > nlp > math > SloppyMath > log
edu APIs stanford APIs nlp APIs math APIs SloppyMath APIs log APIs

Example 1
public static <E, C extends Counter<E>> C tfLogScale(C c, double base) {
    C scaled = (C) c.getFactory().create();
    for (E key : c.keySet()) {
      double cnt = c.getCount(key);
      double scaledCnt = 0.0;
      if (cnt > 0) {
        scaledCnt = 1.0 + SloppyMath.log(cnt, base);
      }
      scaled.setCount(key, scaledCnt);
    }
    return scaled;
  }