return weightSum.get(BayesConstants.TOTAL_SUM);
}
public static double readVocabCount(FileSystem fs, Path pathPattern, Configuration conf) throws IOException {
Map<String,Double> weightSum = new HashMap<String,Double>();
StringTuple key = new StringTuple();
DoubleWritable value = new DoubleWritable();
FileStatus[] outputFiles = fs.globStatus(pathPattern);
for (FileStatus fileStatus : outputFiles) {
Path path = fileStatus.getPath();
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
while (reader.next(key, value)) {
if (weightSum.size() > 1) {
throw new IOException("Incorrect vocabCount File");
}
if (key.stringAt(0).equals(BayesConstants.FEATURE_SET_SIZE)) {
weightSum.put(BayesConstants.FEATURE_SET_SIZE, value.get());
}
}
}