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

Commit aee43c4f authored by Satoshi Kataoka's avatar Satoshi Kataoka Committed by Android (Google) Code Review
Browse files

Merge "Add skeleton classes for gesture"

parents d522ddef 91eb4d89
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ LATIN_IME_CORE_SRC_FILES := \
    dictionary.cpp \
    proximity_info.cpp \
    proximity_info_state.cpp \
    unigram_dictionary.cpp
    unigram_dictionary.cpp \
    gesture/build_check.cpp

LOCAL_SRC_FILES := \
    $(LATIN_IME_JNI_SRC_FILES) \
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
    mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
            fullWordMultiplier, maxWordLength, maxWords, options);
    mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength);
    mGestureDecoder = new GestureDecoder(maxWordLength, maxWords);
    mGestureDecoder->setDict(mUnigramDictionary, mBigramDictionary);
}

Dictionary::~Dictionary() {
+16 −7
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include "bigram_dictionary.h"
#include "char_utils.h"
#include "defines.h"
#include "gesture/gesture_decoder.h"
#include "proximity_info.h"
#include "unigram_dictionary.h"
#include "words_priority_queue_pool.h"
@@ -39,6 +40,12 @@ class Dictionary {
            bool useFullEditDistance, unsigned short *outWords,
            int *frequencies, int *spaceIndices) {
        int result = 0;
        if (isGesture) {
            mGestureDecoder->setPrevWord(prevWordChars, prevWordLength);
            result = mGestureDecoder->getSuggestions(proximityInfo, xcoordinates, ycoordinates,
                    times, pointerIds, codes, codesSize, commitPoint, dicTypeId == 1 /* main */,
                    outWords, frequencies, spaceIndices);
        } else {
            std::map<int, int> bigramMap;
            uint8_t bigramFilter[BIGRAM_FILTER_BYTE_SIZE];
            mBigramDictionary->fillBigramAddressToFrequencyMapAndFilter(prevWordChars,
@@ -46,6 +53,7 @@ class Dictionary {
            result = mUnigramDictionary->getSuggestions(proximityInfo, xcoordinates,
                    ycoordinates, codes, codesSize, &bigramMap, bigramFilter,
                    useFullEditDistance, outWords, frequencies);
        }
        return result;
    }

@@ -79,6 +87,7 @@ class Dictionary {

    const UnigramDictionary *mUnigramDictionary;
    const BigramDictionary *mBigramDictionary;
    GestureDecoder *mGestureDecoder;
};

// public static utility methods
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "gesture_decoder.h"

namespace latinime {
};
// namespace latinime
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef LATINIME_GESTURE_DECODER_H
#define LATINIME_GESTURE_DECODER_H

#include "defines.h"
#include "gesture_decoder_impl.h"

namespace latinime {

class GestureDecoder : public GestureDecoderImpl {

 public:
    GestureDecoder(int maxWordLength, int maxWords) :
            GestureDecoderImpl(maxWordLength, maxWords) {
    }

 private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoder);
};
} // namespace latinime

#endif // LATINIME_INCREMENTAL_DECODER_H
Loading