diff --git a/conv/CMakeLists.txt b/conv/CMakeLists.txt index 9168c6d..333af1f 100644 --- a/conv/CMakeLists.txt +++ b/conv/CMakeLists.txt @@ -1,3 +1,4 @@ +# ---- main procedural add_executable(dcode_feat common.hh dcode_feat.cc) target_link_libraries(dcode_feat PRIVATE args) @@ -18,3 +19,8 @@ target_link_libraries(fprob_feat PRIVATE args) add_executable(feat_dcode common.hh feat_dcode.cc) target_link_libraries(feat_dcode PRIVATE args) + + +# ---- procedural of preprocessing +add_executable(aprob_bmap common.hh aprob_bmap.cc) +target_link_libraries(aprob_bmap PRIVATE args) diff --git a/conv/aprob_bmap.cc b/conv/aprob_bmap.cc new file mode 100644 index 0000000..489f61f --- /dev/null +++ b/conv/aprob_bmap.cc @@ -0,0 +1,55 @@ +#include +#include +#include + +#include + +#include "common.hh" + + +namespace param { +using namespace ::args; + +ArgumentParser parser { + "converter: aprob -> bmap" +}; +HelpFlag help { + parser, "help", "display this menu", {'h', "help"}, +}; + +ValueFlag min { + parser, "0.2", "minimum alter-probability to select", {"min"}, 0.4, +}; +ValueFlag max { + parser, "0.6", "maximum alter-probability to select", {"max"}, 0.6, +}; + +} // namespace param + + +static void Exec() { + const auto aprob = ReadMatrix(std::cin); + + for (auto& probs : aprob) { + for (size_t i = 0; i < probs.size(); ++i) { + if (args::get(param::min) <= probs[i] && probs[i] <= args::get(param::max)) { + std::cout << i << ' '; + } + } + std::cout << '\n'; + } +} + +int main(int argc, char** argv) +try { + param::parser.ParseCLI(argc, argv); + Exec(); + return EXIT_SUCCESS; +} catch (const args::Help&) { + std::cout << param::parser << std::endl; + return EXIT_SUCCESS; +} catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; +} +