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

Commit 5b0761e6 authored by Jean Chalard's avatar Jean Chalard
Browse files

Remove write-only stuff

Change-Id: I5ac8ab64c77a298502b3d063ea70db9b4da41716
parent 1ec1be46
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -26,11 +26,8 @@
namespace latinime {

BigramDictionary::BigramDictionary(const unsigned char *dict, int maxWordLength,
        const bool isLatestDictVersion, const bool hasBigram,
        Dictionary *parentDictionary)
    : DICT(dict), MAX_WORD_LENGTH(maxWordLength),
    IS_LATEST_DICT_VERSION(isLatestDictVersion),
    HAS_BIGRAM(hasBigram), mParentDictionary(parentDictionary) {
    : DICT(dict), MAX_WORD_LENGTH(maxWordLength), mParentDictionary(parentDictionary) {
    if (DEBUG_DICT) {
        AKLOGI("BigramDictionary - constructor");
        AKLOGI("Has Bigram : %d", hasBigram);
+1 −4
Original line number Diff line number Diff line
@@ -22,8 +22,7 @@ namespace latinime {
class Dictionary;
class BigramDictionary {
 public:
    BigramDictionary(const unsigned char *dict, int maxWordLength,
            const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary);
    BigramDictionary(const unsigned char *dict, int maxWordLength, Dictionary *parentDictionary);
    int getBigrams(unsigned short *word, int length, int *codes, int codesSize,
            unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams);
    ~BigramDictionary();
@@ -40,8 +39,6 @@ class BigramDictionary {
    const int MAX_WORD_LENGTH;
    // TODO: Re-implement proximity correction for bigram correction
    static const int MAX_ALTERNATIVES = 1;
    const bool IS_LATEST_DICT_VERSION;
    const bool HAS_BIGRAM;

    Dictionary *mParentDictionary;
    int *mBigramFreq;
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ inline int BinaryFormat::detectFormat(const uint8_t* const dict) {
        // Format 2 header is as follows:
        // Magic number (4 bytes) 0x9B 0xC1 0x3A 0xFE
        // Version number (2 bytes) 0x00 0x02
        // Options (2 bytes) must be 0x00 0x00
        // Options (2 bytes)
        // Header size (4 bytes) : integer, big endian
        return (dict[4] << 8) + dict[5];
    default:
+3 −6
Original line number Diff line number Diff line
@@ -29,9 +29,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
        int typedLetterMultiplier, int fullWordMultiplier,
        int maxWordLength, int maxWords)
    : mDict((unsigned char*) dict), mDictSize(dictSize),
    mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust),
    // Checks whether it has the latest dictionary or the old dictionary
    IS_LATEST_DICT_VERSION((((unsigned char*) dict)[0] & 0xFF) >= DICTIONARY_VERSION_MIN) {
      mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust) {
    if (DEBUG_DICT) {
        if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) {
            AKLOGI("Max word length (%d) is greater than %d",
@@ -44,9 +42,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
            maxWords, SUB_QUEUE_MAX_WORDS, maxWordLength);
    const unsigned int headerSize = BinaryFormat::getHeaderSize(mDict);
    mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
            fullWordMultiplier, maxWordLength, maxWords, IS_LATEST_DICT_VERSION);
    mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength,
            IS_LATEST_DICT_VERSION, true /* hasBigram */, this);
            fullWordMultiplier, maxWordLength, maxWords);
    mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, this);
}

Dictionary::~Dictionary() {
+0 −2
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ class Dictionary {
                codesSize, flags, outWords, frequencies);
    }

    // TODO: Call mBigramDictionary instead of mUnigramDictionary
    int getBigrams(unsigned short *word, int length, int *codes, int codesSize,
            unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) {
        return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies,
@@ -68,7 +67,6 @@ class Dictionary {
    const int mMmapFd;
    const int mDictBufAdjust;

    const bool IS_LATEST_DICT_VERSION;
    UnigramDictionary *mUnigramDictionary;
    BigramDictionary *mBigramDictionary;
    WordsPriorityQueuePool *mWordsPriorityQueuePool;
Loading