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

Commit a88c9682 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Change v403 historical info format."

parents 3cde19de 2383575d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ class HistoricalInfo {
        return mTimestamp;
    }

    // TODO: Remove
    int getLevel() const {
        return mLevel;
    }
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ class ProbabilityEntry {
            encodedEntry = (encodedEntry << (Ver4DictConstants::WORD_LEVEL_FIELD_SIZE * CHAR_BIT))
                    | static_cast<uint8_t>(mHistoricalInfo.getLevel());
            encodedEntry = (encodedEntry << (Ver4DictConstants::WORD_COUNT_FIELD_SIZE * CHAR_BIT))
                    | static_cast<uint8_t>(mHistoricalInfo.getCount());
                    | static_cast<uint16_t>(mHistoricalInfo.getCount());
        } else {
            encodedEntry = (encodedEntry << (Ver4DictConstants::PROBABILITY_SIZE * CHAR_BIT))
                    | static_cast<uint8_t>(mProbability);
+2 −2
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ const int Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE = 3;
const int Ver4DictConstants::NOT_A_TERMINAL_ADDRESS = 0;
const int Ver4DictConstants::TERMINAL_ID_FIELD_SIZE = 4;
const int Ver4DictConstants::TIME_STAMP_FIELD_SIZE = 4;
const int Ver4DictConstants::WORD_LEVEL_FIELD_SIZE = 1;
const int Ver4DictConstants::WORD_COUNT_FIELD_SIZE = 1;
const int Ver4DictConstants::WORD_LEVEL_FIELD_SIZE = 0;
const int Ver4DictConstants::WORD_COUNT_FIELD_SIZE = 2;

const uint8_t Ver4DictConstants::FLAG_REPRESENTS_BEGINNING_OF_SENTENCE = 0x1;
const uint8_t Ver4DictConstants::FLAG_NOT_A_VALID_ENTRY = 0x2;
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ class Ver4DictConstants {
    static const int NOT_A_TERMINAL_ADDRESS;
    static const int TERMINAL_ID_FIELD_SIZE;
    static const int TIME_STAMP_FIELD_SIZE;
    // TODO: Remove
    static const int WORD_LEVEL_FIELD_SIZE;
    static const int WORD_COUNT_FIELD_SIZE;
    // Flags in probability entry.
+1 −3
Original line number Diff line number Diff line
@@ -52,16 +52,14 @@ TEST(LanguageModelDictContentTest, TestUnigramProbabilityWithHistoricalInfo) {

    const int flag = 0xF0;
    const int timestamp = 0x3FFFFFFF;
    const int level = 3;
    const int count = 10;
    const int wordId = 100;
    const HistoricalInfo historicalInfo(timestamp, level, count);
    const HistoricalInfo historicalInfo(timestamp, 0 /* level */, count);
    const ProbabilityEntry probabilityEntry(flag, &historicalInfo);
    languageModelDictContent.setProbabilityEntry(wordId, &probabilityEntry);
    const ProbabilityEntry entry = languageModelDictContent.getProbabilityEntry(wordId);
    EXPECT_EQ(flag, entry.getFlags());
    EXPECT_EQ(timestamp, entry.getHistoricalInfo()->getTimestamp());
    EXPECT_EQ(level, entry.getHistoricalInfo()->getLevel());
    EXPECT_EQ(count, entry.getHistoricalInfo()->getCount());

    // Remove
Loading