float sumProb2 = 0;
for (Entry<String> entry : probDist.entrySet()) {
float pr = entry.getValue() / sumProb;
if (pr > lexProbThreshold) {
sumProb2 += pr;
sortedFilteredProbDist.add(new PairOfStringFloat(entry.getKey(), pr));
}
}
// re-normalize values after removal of low-prob entries
float cumProb = 0;
int cnt = 0;
while (cnt < maxNumTrans && cumProb < cumProbThreshold && !sortedFilteredProbDist.isEmpty()) {
PairOfStringFloat entry = sortedFilteredProbDist.pollLast();
float pr = entry.getValue() / sumProb2;
cumProb += pr;
normProbDist.put(entry.getKey(), pr);
cnt++;
}
probMap.put(sourceTerm, normProbDist);
}