-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstopWords.java
More file actions
41 lines (32 loc) · 968 Bytes
/
Copy pathstopWords.java
File metadata and controls
41 lines (32 loc) · 968 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public static HashSet<String> stopWords = new HashSet<String>();
public static void readStopWords(){
BufferedReader inputStream = null;
try
{
inputStream = new BufferedReader(new FileReader("C:\\Users\\SAISUNDAR\\Documents\\WINTER 2014 COURSES\\Winter Github repositories\\CS221IR_2\\stopWords.txt"));
String l;
boolean isEmpty=true;
while ((l = inputStream.readLine()) != null) {
if(l.length()==0)continue;
stopWords.add(l);
System.out.print(l+'\n');
}
}
catch (FileNotFoundException e) {
System.err.println("FileNotFoundException: " + e.getMessage());
}
catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
}
finally {
try
{
if (inputStream != null) {
inputStream.close();
}
}
catch (IOException e) {
System.err.println("IO exception trying to close the stream " + e.getMessage());
}
}
}