Optimization

pull/190/head
M66B 4 years ago
parent 4d6e8c740b
commit 9d709ccb69

@ -249,15 +249,17 @@ public class MessageClassifier {
JSONArray jwords = new JSONArray(); JSONArray jwords = new JSONArray();
for (Long account : classMessages.keySet()) for (Long account : classMessages.keySet())
for (String word : wordClassFrequency.get(account).keySet()) for (String word : wordClassFrequency.get(account).keySet()) {
for (String clazz : wordClassFrequency.get(account).get(word).keySet()) { Map<String, Integer> classFrequency = wordClassFrequency.get(account).get(word);
for (String clazz : classFrequency.keySet()) {
JSONObject jword = new JSONObject(); JSONObject jword = new JSONObject();
jword.put("account", account); jword.put("account", account);
jword.put("word", word); jword.put("word", word);
jword.put("class", clazz); jword.put("class", clazz);
jword.put("frequency", wordClassFrequency.get(account).get(word).get(clazz)); jword.put("frequency", classFrequency.get(clazz));
jwords.put(jword); jwords.put(jword);
} }
}
JSONObject jroot = new JSONObject(); JSONObject jroot = new JSONObject();
jroot.put("messages", jmessages); jroot.put("messages", jmessages);

Loading…
Cancel
Save