1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-22 06:01:12 +00:00

Include subject for message classification

This commit is contained in:
M66B 2021-01-04 14:37:54 +01:00
parent dea7f671d0
commit 611e1d696c

View file

@ -21,7 +21,6 @@ package eu.faircode.email;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.text.TextUtils;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -73,8 +72,11 @@ public class MessageClassifier {
if (!file.exists()) if (!file.exists())
return; return;
String text = HtmlHelper.getFullText(file); StringBuilder sb = new StringBuilder();
if (TextUtils.isEmpty(text)) if (message.subject != null)
sb.append(message.subject).append('\n');
sb.append(HtmlHelper.getFullText(file));
if (sb.length() == 0)
return; return;
load(context); load(context);
@ -84,7 +86,7 @@ public class MessageClassifier {
if (!wordClassFrequency.containsKey(account.id)) if (!wordClassFrequency.containsKey(account.id))
wordClassFrequency.put(account.id, new HashMap<>()); wordClassFrequency.put(account.id, new HashMap<>());
String classified = classify(account.id, folder.name, text, added, context); String classified = classify(account.id, folder.name, sb.toString(), added, context);
EntityLog.log(context, "Classifier" + EntityLog.log(context, "Classifier" +
" folder=" + folder.name + " folder=" + folder.name +