-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropLetters.java
More file actions
28 lines (23 loc) · 979 Bytes
/
Copy pathDropLetters.java
File metadata and controls
28 lines (23 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.*;
public class DropLetters {
public static void main(String[] args) {
InitDropLetters();
for(String arg : args) {
String fileContents = FileUtil.Concatenate(FileUtil.Read(arg));
String re = "[" + DropLetters + "]";
String changedContents = fileContents.replaceAll(re, "");
FileUtil.Write(arg + ".dropLetters.txt", changedContents);
OneGramFrequencies lf = OneGramFrequencies.Get(true);
System.out.println(arg + ": " + lf.getStandardDeviation(fileContents)
+ " -> " + lf.getStandardDeviation(changedContents));
}
}
public static void InitDropLetters() {
if(DropLetters == null) {
final String filename = "DropLetters.txt";
DropLetters = FileUtil.ReadResource(filename).get(0);
System.out.println("InitDropLetters " + DropLetters);
}
}
private static String DropLetters;
}