- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplitmailText.java
More file actions
Latest commit
52 lines (42 loc) · 1.2 KB
/
Copy pathsplitmailText.java
File metadata and controls
52 lines (42 loc) · 1.2 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
importjava.io.*;
importjava.util.*;
importedu.stanford.nlp.io.*;
importedu.stanford.nlp.ling.*;
importedu.stanford.nlp.pipeline.*;
importedu.stanford.nlp.trees.*;
importedu.stanford.nlp.util.*;
publicclasssplitmailText {
publicstaticvoidmain(Stringargs[]) throwsException{
if (args.length != 2){
System.out.println("Usage : splitmailText <input_file_name> <output_file_name> ");
return;
}
BufferedReaderinput_file = newBufferedReader(newFileReader(newFile("./"+args[0])));
BufferedWriteroutput_file = newBufferedWriter(newFileWriter(newFile("./"+args[1])));
Stringnext_line = null;
booleanflag = false;
while((next_line = input_file.readLine())!=null)
{
StringTokenizerst = newStringTokenizer(next_line);
if (st.hasMoreTokens())
{
Stringfirst_word = st.nextToken();
if (first_word == ">" && !flag)
{
output_file.write("Separate Structure");
flag = true;
}
while (st.hasMoreTokens())
{
Stringnext_word = st.nextToken();
if (next_word != ">")
output_file.write(next_word+" ");
}
}
output_file.write("\n");
output_file.flush();
}
input_file.close();
output_file.close();
}
}