HashMap<String, String> featureMap = new HashMap<String, String>();
Iterator itr = mUseFeatures.iterator();
while(itr.hasNext()) {
String f = (String) itr.next();
Map<String, String> features = mAggregatorManager.getDataMap(f);
// TODO: sanity check for now.
if (features.size() > 1) {
throw new RuntimeException("Incorrect feature format extracted from aggregator.");
}
featureMap.putAll(features);
}
if (!mUsePairedFeatures.isEmpty()) {
itr = mUsePairedFeatures.iterator();
while(itr.hasNext()) {
Pair<String, String> pair = (Pair<String, String>) itr.next();
if (featureMap.containsKey(pair.first) &&
featureMap.containsKey(pair.second)) {
String key = pair.first + Predictor.FEATURE_SEPARATOR + pair.second;
String value = featureMap.get(pair.first) + Predictor.FEATURE_SEPARATOR +
featureMap.get(pair.second);
featureMap.put(key, value);
}
}
}
return (Map)featureMap;