don't prune EMPTY entries

This commit is contained in:
Bernhard Froemel 2026-02-03 12:27:25 +00:00
parent b6cb26dc45
commit dff2581920
1 changed files with 7 additions and 5 deletions

View File

@ -99,11 +99,13 @@ void common_ngram_mod::dec_score_by_index(size_t i) {
void common_ngram_mod::prune_low_score() {
used = 0;
for (size_t i = 0; i < entries.size(); ++i) {
if (scores[i] < common_ngram_mod::SCORE_THR) {
entries[i] = EMPTY;
scores[i] = 0;
} else {
++used;
if (entries[i] != EMPTY) {
if (scores[i] < common_ngram_mod::SCORE_THR) {
entries[i] = EMPTY;
scores[i] = 0;
} else {
++used;
}
}
}
}