MCPcopy Index your code
hub / github.com/LL4J/Filter4J / TextFilter

Class TextFilter

src/filter/TextFilter.java:8–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import java.util.Scanner;
7
8public class TextFilter {
9 private static final String[] script;
10 private static final Tokenizer tokenizer;
11
12 static {
13 try {
14 List<String> scriptList = new ArrayList<>();
15 Scanner sc = new Scanner(new File("judge.model"));
16 while (sc.hasNextLine()) {
17 scriptList.add(sc.nextLine());
18 }
19 script = scriptList.toArray(new String[0]);
20 tokenizer = Tokenizer.loadFromFile("tokenize.model");
21 } catch (Exception ex) {
22 throw new ExceptionInInitializerError(ex);
23 }
24 }
25
26 public TextFilter() {
27 throw new UnsupportedOperationException("This is a static class");
28 }
29
30 public static boolean isIllegal(String text) {
31 return MinRt.doAi(tokenizer.tokenize(text), script) == 1;
32 }
33}

Callers

nothing calls this directly

Calls 1

loadFromFileMethod · 0.95

Tested by

no test coverage detected