output concordia score

Former-commit-id: fa7db09fe9319fa844d294ca4e7deb22d1328151
This commit is contained in:
rjawor 2015-04-21 20:44:49 +02:00
parent 7549703414
commit 5c2ae86097
3 changed files with 8 additions and 2 deletions

View File

@ -125,7 +125,8 @@ int main(int argc, char** argv) {
<< " fragments. " << "Search took: " << << " fragments. " << "Search took: " <<
msdiff.total_milliseconds() << "ms." << std::endl; msdiff.total_milliseconds() << "ms." << std::endl;
if (!cli.count("silent")) { if (!cli.count("silent")) {
std::cout << "\tBest overlay: " << std::endl; std::cout << "\tBest overlay (score="<<
result->getBestOverlayScore()<< "): " << std::endl;
BOOST_FOREACH(MatchedPatternFragment fragment, BOOST_FOREACH(MatchedPatternFragment fragment,
result->getBestOverlay()) { result->getBestOverlay()) {
std::cout << "\t\tfragment [" << fragment.getStart() std::cout << "\t\tfragment [" << fragment.getStart()

View File

@ -39,6 +39,10 @@ public:
return _bestOverlay; return _bestOverlay;
} }
double getBestOverlayScore() const {
return _bestOverlayScore;
}
private: private:
void _checkPossibleOverlays( void _checkPossibleOverlays(
std::vector<MatchedPatternFragment> currentOverlay, std::vector<MatchedPatternFragment> currentOverlay,

View File

@ -204,9 +204,10 @@ BOOST_AUTO_TEST_CASE( ConcordiaSearch1 )
concordia.refreshSAfromRAM(); concordia.refreshSAfromRAM();
boost::shared_ptr<ConcordiaSearchResult> searchResult1 = concordia.concordiaSearch("posiada rysia chyba"); boost::shared_ptr<ConcordiaSearchResult> searchResult1 = concordia.concordiaSearch("posiada rysia chyba");
// best overlay: [], [] // best overlay: [0,2], [2,3], score =
BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().size(), 2); 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).getStart(), 0);
BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(0).getEnd(), 2); BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(0).getEnd(), 2);
BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(1).getStart(), 2); BOOST_CHECK_EQUAL(searchResult1->getBestOverlay().at(1).getStart(), 2);