public static Map<Integer,PriorityQueue<Pair<Double,String>>> getTopWordsByTopics(String stateDirPath, Map<Integer,String> featureIndex, int numWordsToPrint) {
Map<Integer,Double> expSums = new HashMap<Integer, Double>();
Map<Integer,PriorityQueue<Pair<Double,String>>> queues = new HashMap<Integer,PriorityQueue<Pair<Double,String>>>();
SequenceFileDirectoryReader reader = null;
try {
IntPairWritable k = new IntPairWritable();
DoubleWritable v = new DoubleWritable();
reader = new SequenceFileDirectoryReader(new Path(stateDirPath));
while (reader.next(k, v)) {
int topic = k.getFirst();
int featureId = k.getSecond();
if (featureId >= 0 && topic >= 0) {
double score = v.get();
Double curSum = expSums.get(topic);
if (curSum == null) {
curSum = 0.0;