diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2016-05-25 12:50:37 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-05-31 13:48:21 +0300 |
commit | dbdf721ac905bf3b8ddfc7e7ba0513a01d8971d7 (patch) | |
tree | fb9aeea35cd51d0bfb09077c4cdf3228581a3841 /generator | |
parent | ae4e1495284585c71f50811d8827bb24ee01110f (diff) |
[booking] Add quality check for booking
Diffstat (limited to 'generator')
-rw-r--r-- | generator/booking_quality_check/booking_quality_check.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/generator/booking_quality_check/booking_quality_check.cpp b/generator/booking_quality_check/booking_quality_check.cpp new file mode 100644 index 0000000000..bec9448bdf --- /dev/null +++ b/generator/booking_quality_check/booking_quality_check.cpp @@ -0,0 +1,62 @@ +#include "std/iostream.hpp" + +#include "generator/booking_dataset.hpp" +#include "generator/osm_source.hpp" + +#include "3party/gflags/src/gflags/gflags.h" + +DEFINE_bool(generate_classif, false, "Generate classificator."); + +DEFINE_bool(preprocess, false, "1st pass - count features"); +DEFINE_string(osm_file_name, "", "Input .o5m file"); +DEFINE_string(booking_data, "", "Path to booking data in .tsv format"); +DEFINE_uint64(selection_size, 1000, "Selection size"); + +int main(int argc, char * argv[]) +{ + google::SetUsageMessage("Takes OSM XML data from stdin and creates" + " data and index files in several passes."); + google::ParseCommandLineFlags(&argc, &argv, true); + + LOG_SHORT(LINFO, ("Booking data:",FLAGS_booking_data)); + + BookingDataset bookingDataset(FLAGS_booking_data); + + // Here we can add new tags to element!!! + auto const filterAction = [&](OsmElement * e) + { + if (bookingDataset.BookingFilter(*e)) + return; + + }; + + vector<OsmElement> elements; + auto const counterAction = [&](OsmElement * e) + { + if (bookingDataset.TourismFilter(*e)) + elements.emplace_back(*e); + }; + + LOG_SHORT(LINFO, ("OSM data:", FLAGS_osm_file_name)); + { + SourceReader reader = FLAGS_osm_file_name.empty() ? SourceReader() : SourceReader(FLAGS_osm_file_name); + ProcessOsmElementsFromO5M(reader, counterAction); + } + LOG_SHORT(LINFO, ("Tourism elements:", elements.size())); + + vector<size_t> elementIndexes(elements.size()); + size_t counter = 0; + for (auto & e : elementIndexes) + e = counter++; + + random_shuffle(elementIndexes.begin(), elementIndexes.end()); + elementIndexes.resize(FLAGS_selection_size); + + vector<OsmElement> selectedElements; + for (size_t i : elementIndexes) + selectedElements.emplace_back(elements[i]); + + + + return 0; +}
\ No newline at end of file |