Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed two unicode-related bugs in the text index. #502

Merged
merged 2 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/index/Index.Text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ void Index::passContextFileIntoVector(const string& contextFile,
LOG(WARN) << "There are more entities not in the KB..."
<< " suppressing further warnings...\n";
}
} else {
entityNotFoundErrorMsgCount++;
}
}
} else {
Expand All @@ -189,6 +191,11 @@ void Index::passContextFileIntoVector(const string& contextFile,
LOG(INFO) << "Lines processed: " << i << '\n';
}
}
LOG(WARN)
<< "Number of entity mentions where the entity is not part of the KB: "
<< entityNotFoundErrorMsgCount << std::endl;
LOG(WARN) << "Number of total entity mentions: " << nofEntityPostings
<< std::endl;
++nofContexts;
addContextToVector(writer, currentContext, wordsInContext, entitiesInContext);
_textMeta.setNofTextRecords(nofContexts);
Expand Down
2 changes: 1 addition & 1 deletion src/index/StringSortComparator.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class SimpleStringComparator {
if (cmpRes != 0 || level != Level::TOTAL) {
return cmpRes;
}
return a.compare(b) < 0;
return a.compare(b);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/index/Vocabulary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ void Vocabulary<S, C>::createFromSet(const ad_utility::HashSet<S>& set) {
_words.reserve(set.size());
_words.insert(begin(_words), begin(set), end(set));
LOG(INFO) << "... sorting ...\n";
std::sort(begin(_words), end(_words), _caseComparator);
auto totalComparison = [this](const auto& a, const auto& b) {
return _caseComparator(a, b, SortLevel::TOTAL);
};
std::sort(begin(_words), end(_words), totalComparison);
LOG(INFO) << "Done creating vocabulary.\n";
}

Expand Down