diff --git a/concordia-console/concordia-console.cpp b/concordia-console/concordia-console.cpp index a89d86a..5ce5500 100644 --- a/concordia-console/concordia-console.cpp +++ b/concordia-console/concordia-console.cpp @@ -125,7 +125,8 @@ int main(int argc, char** argv) { << " fragments. " << "Search took: " << msdiff.total_milliseconds() << "ms." << std::endl; if (!cli.count("silent")) { - std::cout << "\tBest overlay: " << std::endl; + std::cout << "\tBest overlay (score="<< + result->getBestOverlayScore()<< "): " << std::endl; BOOST_FOREACH(MatchedPatternFragment fragment, result->getBestOverlay()) { std::cout << "\t\tfragment [" << fragment.getStart() diff --git a/concordia/concordia_search_result.hpp b/concordia/concordia_search_result.hpp index 56f76c2..603296d 100644 --- a/concordia/concordia_search_result.hpp +++ b/concordia/concordia_search_result.hpp @@ -39,6 +39,10 @@ public: return _bestOverlay; } + double getBestOverlayScore() const { + return _bestOverlayScore; + } + private: void _checkPossibleOverlays( std::vector currentOverlay, diff --git a/concordia/t/test_concordia.cpp b/concordia/t/test_concordia.cpp index d5b9872..3317cef 100644 --- a/concordia/t/test_concordia.cpp +++ b/concordia/t/test_concordia.cpp @@ -204,9 +204,10 @@ BOOST_AUTO_TEST_CASE( ConcordiaSearch1 ) concordia.refreshSAfromRAM(); boost::shared_ptr searchResult1 = concordia.concordiaSearch("posiada rysia chyba"); - // best overlay: [], [] + // best overlay: [0,2], [2,3], score = BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().size(), 2); + BOOST_CHECK_CLOSE(searchResult1->getBestOverlayScore(), 0.695, 0.1); BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(0).getStart(), 0); BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(0).getEnd(), 2); BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(1).getStart(), 2);