private double[] getIDFArray(BagOfTokens bag) {
    double[] idfArray = new double[bag.size()];
    Iterator it = bag.tokenIterator();
    int i = 0;
    while (it.hasNext()) {
      Token tok = (Token) it.next();
      idfArray[i] = bag.getWeight(tok);
      i++;
    }
    return idfArray;
  }
private double [ ] getIDFArray ( BagOfTokens bag ) { double [ ] idfArray = new double [ bag . size ( ) ] ; Iterator it = bag . tokenIterator ( ) ; int i = 0 ; while ( it . hasNext ( ) ) { Token tok = ( Token ) it . next ( ) ; idfArray [ i ] = bag . getWeight ( tok ) ; i ++ ; } return idfArray ; }
getIDFArray normalize a vector of IDF weights.

@param bag BagOfTokens
@return double[]