code: public void applyFeatureCountThreshold(List<Pair<Pattern, Integer>> thresholds) {
  
      // get feature counts
      float[] counts = getFeatureCounts();
  
      // build a new featureIndex
      Index<F> newFeatureIndex = new HashIndex<F>();
      LOOP: for (F f : featureIndex) {
        for (Pair<Pattern, Integer> threshold : thresholds) {
          Pattern p = threshold.first();
          Matcher m = p.matcher(f.toString());
          if (m.matches()) {
            if (counts[featureIndex.indexOf(f)] >= threshold.second) {
              newFeatureIndex.add(f);
            }
            continue LOOP;
          }
        }
        // we only get here if it didn't match anything on the list
        newFeatureIndex.add(f);
      }
  
      counts = null;
  
      int[] featMap = new int[featureIndex.size()];
      for (int i = 0; i < featMap.length; i++) {
        featMap[i] = newFeatureIndex.indexOf(featureIndex.get(i));
      }
  
      featureIndex = null;
  
      for (int i = 0; i < size; i++) {
        List<Integer> featList = new ArrayList<Integer>(data[i].length);
        for (int j = 0; j < data[i].length; j++) {
          if (featMap[data[i][j]] >= 0) {
            featList.add(featMap[data[i][j]]);
          }
        }
        data[i] = new int[featList.size()];
        for (int j = 0; j < data[i].length; j++) {
          data[i][j] = featList.get(j);
        }
      }
  
      //TODO: continuation of hack from above... hope those features are really strings
      //if you call this function. ~Sarah
      featureIndex = newFeatureIndex;
    }
docs: Applies feature count thresholds to the Dataset.
  Only features that match pattern_i and occur at
  least threshold_i times (for some i) are kept.
  
  @param thresholds a list of pattern, threshold pairs