-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRank.java
More file actions
51 lines (38 loc) · 1.39 KB
/
Copy pathRank.java
File metadata and controls
51 lines (38 loc) · 1.39 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
package prog11;
import prog02.GUI;
import java.util.*;
public class Rank {
public static void main(String[] args) {
String pageDiskName = "pagedisk-1.txt";
String wordDiskName = "worddisk-1.txt";
Browser browser = new BetterBrowser();
SearchEngine notGPT = new NotGPT();
NotGPT g = (NotGPT) notGPT;
g.pageDisk.read(pageDiskName);
for (Map.Entry<Long,InfoFile> entry : g.pageDisk.entrySet())
g.indexOfURL.put(entry.getValue().data, entry.getKey().toString());
g.wordDisk.read(wordDiskName);
for (Map.Entry<Long,InfoFile> entry : g.wordDisk.entrySet())
g.indexOfWord.put(entry.getValue().data, entry.getKey());
System.out.println("map from URL to page index");
System.out.println(g.indexOfURL);
System.out.println("map from page index to page disk");
System.out.println(g.pageDisk);
System.out.println("map from word to word index");
System.out.println(g.indexOfWord);
System.out.println("map from word index to word file");
System.out.println(g.wordDisk);
notGPT.rank(false);
System.out.println("page disk after slow rank");
for (InfoFile file : g.pageDisk.values())
System.out.println(file);
g.pageDisk.write("slow.txt");
for (InfoFile file : g.pageDisk.values())
file.impact = 0.0;
notGPT.rank(true);
System.out.println("page disk after fast rank");
for (InfoFile file : g.pageDisk.values())
System.out.println(file);
g.pageDisk.write("fast.txt");
}
}