-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
77 lines (64 loc) · 1.37 KB
/
main.cpp
File metadata and controls
77 lines (64 loc) · 1.37 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
73
74
75
76
77
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include "stringsim.h"
#include "Util.h"
using namespace std;
int Tau=3;
int Q=2;
int K=-1;
int main(int argc, char* argv[]){
SetRand();
string filename;
string queryfile;
StringSim collection;
int i=1;
while(i<argc){
if (strcmp("-q", argv[i]) == 0) {
i++;
Q = atoi(argv[i++]);
if(Q>=8){
cout << "q should be smaller than 8" << endl;
}
}
else if (strcmp("-k", argv[i]) == 0) {
i++;
K = atoi(argv[i++]);
}
else if (strcmp("-tau", argv[i]) == 0) {
i++;
Tau = atoi(argv[i++]);
}
else if (strcmp("-query", argv[i]) == 0) {
i++;
queryfile = argv[i++];
}
else {
filename = argv[i++];
}
}
if(K==-1){
K=Tau*Q*16/32;
}
cout << filename << endl;
cout << "K: " << K << "\tQ: " << Q << "\tTau: " << Tau << endl;
cout << "RAND_A: " << RAND_A << "\tRAND_B: " << RAND_B << endl;
collection.ReadStrcol(filename);
clock_t start, end;
start=clock();
collection.Occurencing();
collection.Indexing();
end=clock();
cout << "indexing time: " << (double)(end-start)/CLOCKS_PER_SEC << endl;
cout << "index size: " << (double)(collection.stringnum)*K*8/1024/1024 << "MB" << endl;
if(queryfile!=""){
collection.Query_hashscan(queryfile);
}
cout << endl;
}