Include subject for message classification

pull/190/head
M66B 4 years ago
parent dea7f671d0
commit 611e1d696c

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

Loading…
Cancel
Save