public static int getTotalCount(HashMap<String, TokenDetails> map) { Iterator<Map.Entry<String, TokenDetails>> it = map.entrySet().iterator(); int count = 0; while (it.hasNext()) { Map.Entry<String, TokenDetails> pair = (Map.Entry<String, TokenDetails>) it.next(); TokenDetails td = pair.getValue(); count = count + td.getCount(); } return count; }
public static ArrayList<TokenDetails> filterProbabilities(ArrayList<TokenDetails> tdList) { int size = tdList.size(); ArrayList<TokenDetails> tmpList = new ArrayList<TokenDetails>(); for (int i = 0; i < size; i++) { TokenDetails td = tdList.get(i); // System.out.println(td.getProb()); if ((td.getProb() >= Utility.probabilityThreshold) && (td.getCount() >= Utility.countThreshold)) { tmpList.add(td); } } return tmpList; }