public void lowPassFilter(int cutoff) { Iterator it = keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); if (get(key) >= cutoff) { map.remove(key); } } } // end lowPassFilter
public void highPassFilter(int cutoff) { Iterator it = keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); if (get(key) <= cutoff) { map.remove(key); } } } // end lowPassFilter
Iterator it = keySet().iterator(); int[] freqCount = new int[10]; int freqOther = 0;
public void stat() throws IOException { Iterator it = keySet().iterator(); int[] freqCount = new int[11]; while (it.hasNext()) { String key = (String) it.next(); int freq = get(key); if (freq <= 10) { freqCount[freq]++; } else { freqCount[0]++; } } double c = 0; for (int i = 1; i < freqCount.length; i++) { c += (double) freqCount[i] / size(); logger.info("F(" + i + ")=" + freqCount[i] + " (" + c + ")"); } c += (double) freqCount[0] / size(); logger.info("F(freq>10)=" + freqCount[0] + " (" + c + ")"); } // end stat
Iterator<String> it = documentVocabulary.keySet().iterator(); while (it.hasNext()) {