From 63beb8f87d1e43b6dd5ee9a5913b3e340d751052 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 6 Jan 2021 18:23:58 +0100 Subject: [PATCH] Added classifier logging --- .../main/java/eu/faircode/email/MessageClassifier.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageClassifier.java b/app/src/main/java/eu/faircode/email/MessageClassifier.java index 1c084d0645..40f35b97fa 100644 --- a/app/src/main/java/eu/faircode/email/MessageClassifier.java +++ b/app/src/main/java/eu/faircode/email/MessageClassifier.java @@ -203,6 +203,8 @@ public class MessageClassifier { stat.matchedWords++; stat.totalFrequency += frequency; + if (BuildConfig.DEBUG) + stat.words.add(word); if (stat.matchedWords > maxMatchedWords) maxMatchedWords = stat.matchedWords; @@ -245,12 +247,15 @@ public class MessageClassifier { } Stat stat = classStats.get(clazz); + boolean consider = (stat.matchedWords >= MIN_MATCHED_WORDS); double chance = (double) stat.totalFrequency / messages / maxMatchedWords; Chance c = new Chance(clazz, chance); EntityLog.log(context, "Classifier " + c + " frequency=" + stat.totalFrequency + "/" + messages + - " matched=" + stat.matchedWords + "/" + maxMatchedWords); - if (stat.matchedWords >= MIN_MATCHED_WORDS) + " matched=" + stat.matchedWords + "/" + maxMatchedWords + + " consider=" + consider + + " words=" + TextUtils.join(", ", stat.words)); + if (consider) chances.add(c); } @@ -387,6 +392,7 @@ public class MessageClassifier { private static class Stat { int matchedWords = 0; int totalFrequency = 0; + List words = new ArrayList<>(); } private static class Chance {