mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-28 03:46:00 +01:00
Classifier special case: pick first best
This commit is contained in:
@@ -263,9 +263,6 @@ public class MessageClassifier {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i("Classifier words=" + state.words.size() + " " + TextUtils.join(", ", state.words));
|
||||
|
||||
if (chances.size() <= 1)
|
||||
return null;
|
||||
|
||||
// Sort classes by chance
|
||||
Collections.sort(chances, new Comparator<Chance>() {
|
||||
@Override
|
||||
@@ -278,6 +275,22 @@ public class MessageClassifier {
|
||||
double class_min_chance = prefs.getInt("class_min_probability", 15) / 100.0;
|
||||
double class_min_difference = prefs.getInt("class_min_difference", 50) / 100.0;
|
||||
|
||||
// Special case: pick first best target class
|
||||
if (class_min_difference == 0) {
|
||||
for (Chance chance : chances)
|
||||
if (chance.chance > class_min_chance) {
|
||||
EntityFolder target = db.folder().getFolderByName(message.account, chance.clazz);
|
||||
if (target != null && target.auto_classify_target) {
|
||||
Log.i("Classifier current=" + currentClass + " classified=" + chance.clazz);
|
||||
return chance.clazz;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (chances.size() <= 1)
|
||||
return null;
|
||||
|
||||
// Select best class
|
||||
String classification = null;
|
||||
double c0 = chances.get(0).chance;
|
||||
|
||||
Reference in New Issue
Block a user