Require minimum matched words for classification

This commit is contained in:
M66B 2021-01-03 10:42:59 +01:00
parent 7b765f1ea1
commit 07c13a6a00
1 changed files with 2 additions and 1 deletions

View File

@ -47,6 +47,7 @@ public class MessageClassifier {
private static Map<Long, Map<String, Integer>> classMessages = new HashMap<>();
private static Map<Long, Map<String, Map<String, Integer>>> wordClassFrequency = new HashMap<>();
private static final int MIN_MATCHED_WORDS = 10;
private static final double COMMON_WORD_FACTOR = 0.75;
private static final double CHANCE_THRESHOLD = 2.0;
@ -211,7 +212,7 @@ public class MessageClassifier {
chances.add(c);
}
if (chances.size() <= 1)
if (chances.size() <= 1 || maxMatchedWords < MIN_MATCHED_WORDS)
return null;
Collections.sort(chances, new Comparator<Chance>() {