Fixed undo classify

pull/190/head
M66B 4 years ago
parent 1eb8d7fa3f
commit 873683d5da

@ -109,16 +109,7 @@ public class MessageClassifier {
words.add(word); words.add(word);
Map<String, Integer> classFrequency = wordClassFrequency.get(word); Map<String, Integer> classFrequency = wordClassFrequency.get(word);
if (!added) { if (added) {
Integer c = (classFrequency == null ? null : classFrequency.get(classify));
if (c != null)
if (c > 0)
classFrequency.put(classify, c - 1);
else
classFrequency.remove(classify);
continue;
}
if (classFrequency == null) { if (classFrequency == null) {
classFrequency = new HashMap<>(); classFrequency = new HashMap<>();
wordClassFrequency.put(word, classFrequency); wordClassFrequency.put(word, classFrequency);
@ -162,6 +153,14 @@ public class MessageClassifier {
Integer c = classFrequency.get(classify); Integer c = classFrequency.get(classify);
c = (c == null ? 1 : c + 1); c = (c == null ? 1 : c + 1);
classFrequency.put(classify, c); classFrequency.put(classify, c);
} else {
Integer c = (classFrequency == null ? null : classFrequency.get(classify));
if (c != null)
if (c > 0)
classFrequency.put(classify, c - 1);
else
classFrequency.remove(classify);
}
} }
start = end; start = end;
} }

Loading…
Cancel
Save