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

Method loadFromFile

src/filter/Tokenizer.java:13–25  ·  view source on GitHub ↗
(String filename)

Source from the content-addressed store, hash-verified

11 }
12
13 public static Tokenizer loadFromFile(String filename) {
14 try {
15 Scanner scanner = new Scanner(new File(filename));
16 int size = Integer.parseInt(scanner.nextLine());
17 String[] vocab = new String[size];
18 for (int i = 0; i < size; i++) {
19 vocab[i] = scanner.nextLine();
20 }
21 return new Tokenizer(vocab);
22 } catch (Exception ignored) {
23 }
24 return null;
25 }
26
27 public double[] tokenize(String text) {
28 double[] values = new double[vocab.length];

Callers 1

TextFilterClass · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected