LOG.fatal("died reading queries from json file", e);
System.exit(-1);
}
JsonArray queryObjectArray = obj.getAsJsonArray("queries");
queryList = new ArrayList<GQuery>(queryObjectArray.size());
nameToIndex = new HashMap<String,Integer>(queryList.size());
Iterator<JsonElement> queryObjectIterator = queryObjectArray.iterator();
int k=0;
while(queryObjectIterator.hasNext()) {
JsonObject queryObject = (JsonObject) queryObjectIterator.next();
String title = queryObject.get("title").getAsString();
String text = queryObject.get("text").getAsString();
double epoch = queryObject.get("epoch").getAsDouble();
long querytweettime = queryObject.get("querytweettime").getAsLong();
nameToIndex.put(title, k++);
FeatureVector featureVector = new FeatureVector(null);
JsonArray modelObjectArray = queryObject.getAsJsonArray("model");
Iterator<JsonElement> featureIterator = modelObjectArray.iterator();
while(featureIterator.hasNext()) {
JsonObject featureObject = (JsonObject)featureIterator.next();
double weight = featureObject.get("weight").getAsDouble();
String feature = featureObject.get("feature").getAsString();
featureVector.addTerm(feature, weight);