-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.java
More file actions
72 lines (62 loc) · 2.11 KB
/
Driver.java
File metadata and controls
72 lines (62 loc) · 2.11 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package lse;
import java.io.*;
import java.util.*;
//import javax.print.attribute.DocAttributeSet;
public class Driver {
static Scanner sc = new Scanner(System.in);
static String getOption()
{
System.out.print("getKeyWord(): ");
String response = sc.next();
return response;
}
public static void main(String args[]) throws FileNotFoundException
{
/*Scanner sc = new Scanner(new File("AliceCh1.txt"));
LittleSearchEngine s = new LittleSearchEngine();
while(sc.hasNext()) {
String temp = s.getKeyword(sc.next());
System.out.println(temp);
}*/
ArrayList<Occurrence> trial = new ArrayList<>();
Occurrence temp = new Occurrence("AliceCh1.txt", 12);
trial.add(temp);
Occurrence temp1 = new Occurrence("AliceCh1.txt", 55);
trial.add(temp1);
Occurrence temp2 = new Occurrence("AliceCh1.txt", 7);
trial.add(temp2);
Occurrence temp3 = new Occurrence("AliceCh1.txt", 5);
trial.add(temp3);
Occurrence temp4 = new Occurrence("AliceCh1.txt", 3);
trial.add(temp4);
Occurrence temp5 = new Occurrence("AliceCh1.txt", 2);
trial.add(temp5);
Occurrence temp6 = new Occurrence("AliceCh1.txt", 6);
trial.add(temp6);
Occurrence temp7 = new Occurrence("AliceCh1.txt", 4);
trial.add(temp7);
LittleSearchEngine lse = new LittleSearchEngine();
try{
lse.makeIndex("docs.txt", "noisewords.txt");
} catch (FileNotFoundException e){
System.out.println("Hello World");
}
//ArrayList<Integer> copy = lse.insertLastOccurrence(trial);
/*for(int i = 0; i < copy.size(); i++) {
System.out.println("Index: " + i);
System.out.println(copy.get(i));
//System.out.println(copy.get(i).frequency);
}*/
HashMap<String, ArrayList<Occurrence>> hashM = lse.keywordsIndex;
for(String w : hashM.keySet()) {
System.out.println("Key: " + w);
ArrayList<Occurrence> temp10 = hashM.get(w);
for(int j = 0; j < temp10.size(); j++) {
//System.out.println("Key: " + w);
System.out.println(temp10.get(j));
}
}
System.out.println("I am here");
System.out.println(lse.top5search("red", "orange"));
}
}