Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cf55507 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Fix: BoS prediction after inputting just once.

Change-Id: Ib69569ab6b6edfcc8c1d2c621b95de4127789ab6
parent 2af3fc32
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -146,8 +146,16 @@ void Ver4PatriciaTriePolicy::iterateNgramEntries(const WordIdArrayView prevWordI
            if (!probabilityEntry.isValid()) {
                continue;
            }
            const int probability = probabilityEntry.hasHistoricalInfo() ?
                    0 : probabilityEntry.getProbability();
            int probability = NOT_A_PROBABILITY;
            if (probabilityEntry.hasHistoricalInfo()) {
                // TODO: Quit checking count here.
                // If count <= 1, the word can be an invaild word. The actual probability should
                // be checked using getWordAttributesInContext() in onVisitEntry().
                probability = probabilityEntry.getHistoricalInfo()->getCount() <= 1 ?
                        NOT_A_PROBABILITY : 0;
            } else {
                probability = probabilityEntry.getProbability();
            }
            listener->onVisitEntry(probability, entry.getWordId());
        }
    }