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

Commit 43779c04 authored by Tom Ouyang's avatar Tom Ouyang Committed by Android (Google) Code Review
Browse files

Merge "Add method to get dictionary flags from DicTraverseSession"

parents 224e969e ede23336
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -103,4 +103,9 @@ int Dictionary::getProbability(const int *word, int length) const {
bool Dictionary::isValidBigram(const int *word1, int length1, const int *word2, int length2) const {
    return mBigramDictionary->isValidBigram(word1, length1, word2, length2);
}

int Dictionary::getDictFlags() const {
    return mUnigramDictionary->getDictFlags();
}

} // namespace latinime
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ class Dictionary {
    int getDictSize() const { return mDictSize; }
    int getMmapFd() const { return mMmapFd; }
    int getDictBufAdjust() const { return mDictBufAdjust; }
    int getDictFlags() const;
    virtual ~Dictionary();

 private:
+4 −0
Original line number Diff line number Diff line
@@ -84,6 +84,10 @@ const uint8_t *DicTraverseSession::getOffsetDict() const {
    return mDictionary->getOffsetDict();
}

int DicTraverseSession::getDictFlags() const {
    return mDictionary->getDictFlags();
}

void DicTraverseSession::resetCache(const int nextActiveCacheSize, const int maxWords) {
    mDicNodesCache.reset(nextActiveCacheSize, maxWords);
    mBigramCacheMap.clear();
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class DicTraverseSession {
    void resetCache(const int nextActiveCacheSize, const int maxWords);

    const uint8_t *getOffsetDict() const;
    bool canUseCache() const;
    int getDictFlags() const;

    //--------------------
    // getters and setters
+3 −3
Original line number Diff line number Diff line
@@ -32,9 +32,9 @@
namespace latinime {

// TODO: check the header
UnigramDictionary::UnigramDictionary(const uint8_t *const streamStart, const unsigned int flags)
UnigramDictionary::UnigramDictionary(const uint8_t *const streamStart, const unsigned int dictFlags)
        : DICT_ROOT(streamStart), ROOT_POS(0),
          MAX_DIGRAPH_SEARCH_DEPTH(DEFAULT_MAX_DIGRAPH_SEARCH_DEPTH), FLAGS(flags) {
          MAX_DIGRAPH_SEARCH_DEPTH(DEFAULT_MAX_DIGRAPH_SEARCH_DEPTH), DICT_FLAGS(dictFlags) {
    if (DEBUG_DICT) {
        AKLOGI("UnigramDictionary - constructor");
    }
@@ -163,7 +163,7 @@ int UnigramDictionary::getSuggestions(ProximityInfo *proximityInfo, const int *x
    masterCorrection.resetCorrection();
    const DigraphUtils::digraph_t *digraphs = 0;
    const int digraphsSize =
            DigraphUtils::getAllDigraphsForDictionaryAndReturnSize(FLAGS, &digraphs);
            DigraphUtils::getAllDigraphsForDictionaryAndReturnSize(DICT_FLAGS, &digraphs);
    if (digraphsSize > 0)
    { // Incrementally tune the word and try all possibilities
        int codesBuffer[sizeof(*inputCodePoints) * inputSize];
Loading