This commit is contained in:
rjawor 2019-05-21 12:33:08 +02:00
parent e77da2f479
commit 1b673f603d

View File

@ -199,16 +199,20 @@ ExampleOccurrence UnitDAO::_getExampleOccurrence(DBconnection & connection, cons
BOOST_FOREACH (QueryParam * param, params) { BOOST_FOREACH (QueryParam * param, params) {
delete param; delete param;
} }
Logger::log("params deleted");
std::vector<int> targetTokens = _getArray(targetTokensRaw); std::vector<int> targetTokens = _getArray(targetTokensRaw);
std::vector<std::vector<int> > alignments = _get2DArray(alignmentsRaw); std::vector<std::vector<int> > alignments = _get2DArray(alignmentsRaw);
Logger::log("arrays got");
std::set<int> matchedTargetTokens; std::set<int> matchedTargetTokens;
for(int sourceTokenIndex = sOccurrence.getOffset(); sourceTokenIndex < sOccurrence.getOffset()+matchedLength; sourceTokenIndex++) { for(int sourceTokenIndex = sOccurrence.getOffset(); sourceTokenIndex < sOccurrence.getOffset()+matchedLength; sourceTokenIndex++) {
BOOST_FOREACH(int & targetTokenIndex, alignments.at(sourceTokenIndex)) { BOOST_FOREACH(int & targetTokenIndex, alignments.at(sourceTokenIndex)) {
matchedTargetTokens.insert(targetTokenIndex); matchedTargetTokens.insert(targetTokenIndex);
} }
} }
Logger::log("matched target tokens computed");
int prevPos = -2; int prevPos = -2;
int currStart = -1; int currStart = -1;
@ -232,12 +236,15 @@ ExampleOccurrence UnitDAO::_getExampleOccurrence(DBconnection & connection, cons
prevPos = targetPos; prevPos = targetPos;
} }
Logger::log("matched target tokens added");
// check if there are remaining fragments // check if there are remaining fragments
if (currStart >= 0) { if (currStart >= 0) {
occurrence.addMatchedTargetFragment(std::pair<int,int>(currStart,currEnd)); occurrence.addMatchedTargetFragment(std::pair<int,int>(currStart,currEnd));
} }
Logger::log("getFullSearchResult done");
return occurrence; return occurrence;
} }