-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (33 loc) · 1.14 KB
/
main.cpp
File metadata and controls
38 lines (33 loc) · 1.14 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
#include "SimSearcher.h"
#include <fstream>
#include <string>
#include <time.h>
using namespace std;
int main(int argc, char **argv)
{
clock_t start,end;
SimSearcher searcher;
vector<pair<unsigned, unsigned> > resultED;
vector<pair<unsigned, double> > resultJaccard;
unsigned q = 3, edThreshold = 3;
double jaccardThreshold = 0.5;
ifstream fin("E:\\semester\\dabase-training\\hw1\\test1\\query.txt");
if(!fin) {cout<<"could not open query file"<<endl;return 0;}
searcher.createIndex(argv[1], q);
start= clock();
//searcher.searchJaccard("hello world", jaccardThreshold, resultJaccard);
string query;
ofstream fout("E:\\semester\\dabase-training\\hw1\\test1\\cur-eiditon\\result.txt");
while(getline(fin,query)){
searcher.searchJaccard(query.c_str(), jaccardThreshold, resultJaccard);
for(int i = 0;i<resultJaccard.size();i++){
fout<<resultJaccard[i].first<<' '<<resultJaccard[i].second<<endl;
}
fout<<"--------"<<endl;
}
fin.close();
fout.close();
end = clock();
cout<<"run time:"<<(double)(end-start)/CLOCKS_PER_SEC<<'s'<<endl;
return 0;
}