Fixed undo classify

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

@ -109,16 +109,7 @@ public class MessageClassifier {
words.add(word);
Map<String, Integer> classFrequency = wordClassFrequency.get(word);
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 (added) {
if (classFrequency == null) {
classFrequency = new HashMap<>();
wordClassFrequency.put(word, classFrequency);
@ -162,6 +153,14 @@ public class MessageClassifier {
Integer c = classFrequency.get(classify);
c = (c == null ? 1 : c + 1);
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;
}

Loading…
Cancel
Save