Slide 9
Slide 9 text
jgs
00000011
The Blob
public class Main {
public static void main(String[] args) throws Exception {
String text;
// read text file
File file = new File("/Users/Desktop/input.txt");
BufferedReader br = new BufferedReader(new FileReader(file));
String str;
while ((str = br.readLine()) != null) {
text = text + str;
System.out.println(str);
}
// split words
Vector tokens = new Vector();
String line;
int counterOfLines = 1;
do {
int eolAt = text.indexOf(/*System.lineSeparator()*/"\n");
if (eolAt >= 0) {
line = text.substring(0, eolAt);
if (text.length() > 0) text = text.substring(eolAt + 1);
} else {
line = text;
text = "";
}
splitLine(counterOfLines, line);
counterOfLines++;
} while (!text.equals(""));
}
// token classification
int index = 0;
char currentChar = ' ‘;
String string = "";
if (line.equals("")) return;
// etc...