diff options
author | 2012-08-02 05:07:43 -0700 | |
---|---|---|
committer | 2012-08-02 05:07:43 -0700 | |
commit | 6c465d9d26c7389357dedd4b71c6a95ccb6f019c (patch) | |
tree | 7bb46286f51ff0a1349577cc741940d21e918603 /native/jni/src/dictionary.cpp | |
parent | 2af1b1241b120e0e9df53edd415601e14fc54e0e (diff) | |
parent | 77e8e81ad95cfc1eb8f8407fc872674b8d08bbe9 (diff) | |
download | latinime-6c465d9d26c7389357dedd4b71c6a95ccb6f019c.tar.gz latinime-6c465d9d26c7389357dedd4b71c6a95ccb6f019c.tar.xz latinime-6c465d9d26c7389357dedd4b71c6a95ccb6f019c.zip |
am 77e8e81a: Header cleanup. Moved a couple of functions from .h to .cpp.
* commit '77e8e81ad95cfc1eb8f8407fc872674b8d08bbe9':
Header cleanup. Moved a couple of functions from .h to .cpp.
Diffstat (limited to 'native/jni/src/dictionary.cpp')
-rw-r--r-- | native/jni/src/dictionary.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/dictionary.cpp index b9f65346e..6c722117d 100644 --- a/native/jni/src/dictionary.cpp +++ b/native/jni/src/dictionary.cpp @@ -16,10 +16,14 @@ #define LOG_TAG "LatinIME: dictionary.cpp" +#include <stdint.h> + +#include "bigram_dictionary.h" #include "binary_format.h" #include "defines.h" #include "dictionary.h" #include "gesture_decoder_wrapper.h" +#include "unigram_dictionary.h" namespace latinime { @@ -52,6 +56,37 @@ Dictionary::~Dictionary() { delete mGestureDecoder; } +int Dictionary::getSuggestions(ProximityInfo *proximityInfo, int *xcoordinates, int *ycoordinates, + int *times, int *pointerIds, int *codes, int codesSize, int *prevWordChars, + int prevWordLength, int commitPoint, bool isGesture, + bool useFullEditDistance, unsigned short *outWords, + int *frequencies, int *spaceIndices, int *outputTypes) { + int result = 0; + if (isGesture) { + mGestureDecoder->setPrevWord(prevWordChars, prevWordLength); + result = mGestureDecoder->getSuggestions(proximityInfo, xcoordinates, ycoordinates, + times, pointerIds, codes, codesSize, commitPoint, + outWords, frequencies, spaceIndices, outputTypes); + return result; + } else { + std::map<int, int> bigramMap; + uint8_t bigramFilter[BIGRAM_FILTER_BYTE_SIZE]; + mBigramDictionary->fillBigramAddressToFrequencyMapAndFilter(prevWordChars, + prevWordLength, &bigramMap, bigramFilter); + result = mUnigramDictionary->getSuggestions(proximityInfo, xcoordinates, + ycoordinates, codes, codesSize, &bigramMap, bigramFilter, + useFullEditDistance, outWords, frequencies, outputTypes); + return result; + } +} + +int Dictionary::getBigrams(const int32_t *word, int length, int *codes, int codesSize, + unsigned short *outWords, int *frequencies, int *outputTypes) const { + if (length <= 0) return 0; + return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies, + outputTypes); +} + int Dictionary::getFrequency(const int32_t *word, int length) const { return mUnigramDictionary->getFrequency(word, length); } |