-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
98 lines (79 loc) · 3.23 KB
/
main.cpp
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//prj
#include "ItemSetContainer.hh"
#include "str_pool.hh"
//std
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//boost
#include <boost/program_options.hpp>
#include <boost/assign.hpp>
using namespace boost::assign;
namespace po = boost::program_options;
int main(int argc, char *argv[]) {
const char* logo =
"+------------------------------------------------------------------------+\n"
"| +------------------------------------------------------------------+ |\n"
"| | _ ___ | |\n"
"| | __ _ ___| | ___ __ ( _ ) _ __ _ __ ___ _ __ | |\n"
"| | / _` / __| |/ / '__| / _ \\/\\ | '_ \\| '_ ` _ \\| '__| | |\n"
"| | | (_| \\__ \\ <| | | (_> < | |_) | | | | | | | | |\n"
"| | \\__,_|___/_|\\_\\_| \\___/\\/ | .__/|_| |_| |_|_| | |\n"
"| | |_| | |\n"
"| | _ _ _ | |\n"
"| | _ __ _ __ ___ __| |_ _ ___| |_(_) ___ _ __ ___ | |\n"
"| | | '_ \\| '__/ _ \\ / _` | | | |/ __| __| |/ _ \\| '_ \\/ __| | |\n"
"| | | |_) | | | (_) | (_| | |_| | (__| |_| | (_) | | | \\__ \\ | |\n"
"| | | .__/|_| \\___/ \\__,_|\\__,_|\\___|\\__|_|\\___/|_| |_|___/ | |\n"
"| | |_| | |\n"
"| | | |\n"
"| +------------------------------------------------------------------+ |\n"
"+------------------------------------------------------------------------+\n";
std::cout << logo << std::endl;
for(auto i = 0; i < 5; ++i)
std::cout << "ATTN: tags.txt works good with minsup 0.01" << std::endl;
std::cout << std::endl;
// Declare the supported options.
po::options_description desc("Allowed options");
desc.add_options()
("help", "help message")
("file", po::value<std::string>(), "input file")
("minsup", po::value<double>(), "minsup")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if (vm.count("help")) {
std::cout << desc << "\n";
return 1;
}
if (vm.count("file")) {
std::cout << "Input file: "
<< vm["file"].as<std::string>() << ".\n";
} else {
std::cout << "No input file. \n";
return EXIT_FAILURE;
}
double minsup;
if (vm.count("minsup")) {
std::cout << "Minsup: "
<< vm["minsup"].as<double>() << ".\n";
minsup = vm["minsup"].as<double>();
} else {
std::cout << "No minsup. Assuming 0.5";
minsup = 0.5;
}
str_pool pool;
ItemSetContainer transactions(vm["file"].as<std::string>(), pool);
std::vector<ItemSetContainer> runs;
runs.push_back(transactions.init_pass(minsup));
while(!runs.back().empty()) {
runs.push_back(runs.back().generate_candidates(transactions, minsup));
if(!runs.back().empty())
std::cout << "Result of generation: " << std::endl
<< runs.back() << std::endl << std::endl;
else
std::cout << "Generated empty result. End of story." << std::endl;
}
}