Revert "Clear classifier data when folder deleted"

This reverts commit ae0d96fbd8.
pull/206/head
M66B 3 years ago
parent 128d4e1c03
commit 7a92e0b525

@ -177,20 +177,19 @@ public class MessageClassifier {
private static String classify(EntityMessage message, @NonNull String currentClass, @NonNull List<String> texts, boolean added, @NonNull Context context) { private static String classify(EntityMessage message, @NonNull String currentClass, @NonNull List<String> texts, boolean added, @NonNull Context context) {
State state = new State(); State state = new State();
DB db = DB.getInstance(context);
// Check classes // Check classes
boolean clear = false; DB db = DB.getInstance(context);
for (String clazz : new ArrayList<>(classMessages.get(message.account).keySet())) { for (String clazz : new ArrayList<>(classMessages.get(message.account).keySet())) {
EntityFolder folder = db.folder().getFolderByName(message.account, clazz); EntityFolder folder = db.folder().getFolderByName(message.account, clazz);
if (folder == null) { if (folder == null) {
EntityLog.log(context, EntityLog.Type.Classification, message, EntityLog.log(context, EntityLog.Type.Classification, message,
"Classifier deleted folder=" + message.account + ":" + clazz); "Classifier deleting folder class=" + message.account + ":" + clazz);
clear = true; classMessages.get(message.account).remove(clazz);
for (String word : wordClassFrequency.get(message.account).keySet())
wordClassFrequency.get(message.account).get(word).remove(clazz);
} }
} }
if (clear)
clear(context);
Log.i("Classifier texts=" + texts.size()); Log.i("Classifier texts=" + texts.size());
for (String text : texts) { for (String text : texts) {

Loading…
Cancel
Save