File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
application/src/main/java/org/togetherjava/tjbot/commands/moderation/scam Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 88import java .net .URI ;
99import java .util .regex .Pattern ;
1010
11- public class ScamDetector {
11+ /**
12+ * Detects whether a text message classifies as scam or not, using certain heuristics.
13+ *
14+ * Highly configurable, using {@link ScamBlockerConfig}. Main method to use is
15+ * {@link #isScam(CharSequence)}.
16+ */
17+ public final class ScamDetector {
1218 private static final Pattern TOKENIZER = Pattern .compile ("[\\ s,]" );
1319 private final ScamBlockerConfig config ;
1420
21+ /**
22+ * Creates a new instance with the given configuration
23+ *
24+ * @param config the scam blocker config to use
25+ */
1526 public ScamDetector (@ NotNull Config config ) {
1627 this .config = config .getScamBlocker ();
1728 }
1829
30+ /**
31+ * Detects whether the given message classifies as scam or not, using certain heuristics.
32+ *
33+ * @param message the message to analyze
34+ * @return Whether the message classifies as scam
35+ */
1936 public boolean isScam (@ NotNull CharSequence message ) {
2037 AnalyseResults results = new AnalyseResults ();
2138 TOKENIZER .splitAsStream (message ).forEach (token -> analyzeToken (token , results ));
You can’t perform that action at this time.
0 commit comments