// parse training data into clusters
Map<String, Clusters> clusterMembership = new HashMap<String, Clusters>();
JSONParser parser = new JSONParser();
try {
JSONObject parseObj = (JSONObject) parser.parse(new FileReader(trainingFile));
JSONObject topicObj = (JSONObject) parseObj.get("topics");
Set<String> topics = topicObj.keySet();
Iterator<String> topicIt = topics.iterator();
while (topicIt.hasNext()) { // for each topic
String topic = topicIt.next();
clusterMembership.put(topic, new Clusters());
JSONArray clusters = (JSONArray) ((JSONObject) topicObj.get(topic)).get("clusters");
Iterator<JSONArray> clusterIt = clusters.iterator();
while (clusterIt.hasNext()) { // for each cluster in the topic
JSONArray cluster = (JSONArray) clusterIt.next();
Cluster c = new Cluster();
Iterator<String> clusterMemberIt = cluster.iterator();