| 6 | import java.util.Scanner; |
| 7 | |
| 8 | public 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 | } |
nothing calls this directly
no test coverage detected