|
|
@ -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)
|
|
|
|