Added classifier log type

pull/204/head
M66B 3 years ago
parent 5965cca34a
commit f473969386

@ -59,7 +59,7 @@ public class EntityLog {
@NonNull @NonNull
public String data; public String data;
enum Type {General, Statistics, Scheduling, Network, Account, Protocol} enum Type {General, Statistics, Scheduling, Network, Account, Protocol, Classification}
private static final ExecutorService executor = private static final ExecutorService executor =
Helper.getBackgroundExecutor(1, "log"); Helper.getBackgroundExecutor(1, "log");

@ -90,14 +90,15 @@ public class MessageClassifier {
String classified = classify(folder.account, folder.name, texts, target == null, context); String classified = classify(folder.account, folder.name, texts, target == null, context);
long elapsed = new Date().getTime() - start; long elapsed = new Date().getTime() - start;
EntityLog.log(context, "Classifier" + EntityLog.log(context, EntityLog.Type.Classification,
" folder=" + folder.name + "Classifier" +
" message=" + message.id + " folder=" + folder.name +
"@" + new Date(message.received) + " message=" + message.id +
":" + message.subject + "@" + new Date(message.received) +
" class=" + classified + ":" + message.subject +
" re=" + message.auto_classified + " class=" + classified +
" elapsed=" + elapsed); " re=" + message.auto_classified +
" elapsed=" + elapsed);
// Auto classify message // Auto classify message
if (classified != null && if (classified != null &&
@ -182,7 +183,8 @@ public class MessageClassifier {
for (String clazz : new ArrayList<>(classMessages.get(account).keySet())) { for (String clazz : new ArrayList<>(classMessages.get(account).keySet())) {
EntityFolder folder = db.folder().getFolderByName(account, clazz); EntityFolder folder = db.folder().getFolderByName(account, clazz);
if (folder == null) { if (folder == null) {
EntityLog.log(context, "Classifier deleting folder class=" + account + ":" + clazz); EntityLog.log(context, EntityLog.Type.Classification,
"Classifier deleting folder class=" + account + ":" + clazz);
classMessages.get(account).remove(clazz); classMessages.get(account).remove(clazz);
for (String word : wordClassFrequency.get(account).keySet()) for (String word : wordClassFrequency.get(account).keySet())
wordClassFrequency.get(account).get(word).remove(clazz); wordClassFrequency.get(account).get(word).remove(clazz);
@ -250,10 +252,11 @@ public class MessageClassifier {
double chance = stat.totalFrequency / maxMessages / words; double chance = stat.totalFrequency / maxMessages / words;
Chance c = new Chance(clazz, chance); Chance c = new Chance(clazz, chance);
chances.add(c); chances.add(c);
EntityLog.log(context, "Classifier " + c + EntityLog.log(context, EntityLog.Type.Classification,
" frequency=" + (Math.round(stat.totalFrequency * 100.0) / 100.0) + "/" + maxMessages + " msgs" + "Classifier " + c +
" matched=" + stat.matchedWords + "/" + words + " words" + " frequency=" + (Math.round(stat.totalFrequency * 100.0) / 100.0) + "/" + maxMessages + " msgs" +
" text=" + TextUtils.join(", ", stat.words)); " matched=" + stat.matchedWords + "/" + words + " words" +
" text=" + TextUtils.join(", ", stat.words));
} }
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)

Loading…
Cancel
Save