|
|
@ -255,12 +255,17 @@ public class MessageClassifier {
|
|
|
|
if (maxMatchedWords == 0)
|
|
|
|
if (maxMatchedWords == 0)
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
List<Chance> chances = new ArrayList<>();
|
|
|
|
List<Chance> chances = new ArrayList<>();
|
|
|
|
for (String clazz : classStats.keySet()) {
|
|
|
|
for (String clazz : classStats.keySet()) {
|
|
|
|
Integer messages = classMessages.get(account).get(clazz);
|
|
|
|
Integer messages = classMessages.get(account).get(clazz);
|
|
|
|
if (messages == null || messages == 0)
|
|
|
|
if (messages == null || messages == 0)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EntityFolder folder = db.folder().getFolderByName(account, clazz);
|
|
|
|
|
|
|
|
if (folder == null)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
Stat stat = classStats.get(clazz);
|
|
|
|
Stat stat = classStats.get(clazz);
|
|
|
|
double chance = (double) stat.totalFrequency / messages / maxMatchedWords;
|
|
|
|
double chance = (double) stat.totalFrequency / messages / maxMatchedWords;
|
|
|
|
Chance c = new Chance(clazz, chance);
|
|
|
|
Chance c = new Chance(clazz, chance);
|
|
|
|