Skip to content

Commit

Permalink
Update the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukhnos committed Feb 19, 2024
1 parent 91b5e20 commit 3f9392c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Engine/McBopomofoLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ std::vector<Formosa::Gramambular2::LanguageModel::Unigram> McBopomofoLM::getUnig
allUnigrams = filterAndTransformUnigrams(rawGlobalUnigrams, excludedValues, insertedValues);
}

// TODO(#118): Leaky abstraction. This relies on the impl. detail that we always use the default separator.
// This relies on the fact that we always use the default separator.
bool isKeyMultiSyllable = key.find(Formosa::Gramambular2::ReadingGrid::kDefaultSeparator) != std::string::npos;
if (isKeyMultiSyllable || allUnigrams.empty()) {
allUnigrams.insert(allUnigrams.begin(), userUnigrams.begin(), userUnigrams.end());
} else {
// Score rewrite. To ensure fairness, each user unigram is assigned a
// score that is slightly higher than its peer unigrams.
// score that is slightly higher than the highest of the current ones
// in allUnigrams.
double topScore = std::numeric_limits<double>::lowest();
for (const auto& unigram : allUnigrams) {
if (unigram.score() > topScore) {
Expand Down

0 comments on commit 3f9392c

Please # to comment.