Merge "Fix indentations."
This commit is contained in:
commit
ecbf3f2cbc
8 changed files with 20 additions and 21 deletions
|
@ -21,14 +21,14 @@ namespace latinime {
|
||||||
|
|
||||||
class Dictionary;
|
class Dictionary;
|
||||||
class BigramDictionary {
|
class BigramDictionary {
|
||||||
public:
|
public:
|
||||||
BigramDictionary(const unsigned char *dict, int maxWordLength, int maxAlternatives,
|
BigramDictionary(const unsigned char *dict, int maxWordLength, int maxAlternatives,
|
||||||
const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary);
|
const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary);
|
||||||
int getBigrams(unsigned short *word, int length, int *codes, int codesSize,
|
int getBigrams(unsigned short *word, int length, int *codes, int codesSize,
|
||||||
unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams,
|
unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams,
|
||||||
int maxAlternatives);
|
int maxAlternatives);
|
||||||
~BigramDictionary();
|
~BigramDictionary();
|
||||||
private:
|
private:
|
||||||
bool addWordBigram(unsigned short *word, int length, int frequency);
|
bool addWordBigram(unsigned short *word, int length, int frequency);
|
||||||
int getBigramAddress(int *pos, bool advance);
|
int getBigramAddress(int *pos, bool advance);
|
||||||
int getBigramFreq(int *pos);
|
int getBigramFreq(int *pos);
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
|
||||||
class BinaryFormat {
|
class BinaryFormat {
|
||||||
private:
|
private:
|
||||||
const static int32_t MINIMAL_ONE_BYTE_CHARACTER_VALUE = 0x20;
|
const static int32_t MINIMAL_ONE_BYTE_CHARACTER_VALUE = 0x20;
|
||||||
const static int32_t CHARACTER_ARRAY_TERMINATOR = 0x1F;
|
const static int32_t CHARACTER_ARRAY_TERMINATOR = 0x1F;
|
||||||
const static int MULTIPLE_BYTE_CHARACTER_ADDITIONAL_SIZE = 2;
|
const static int MULTIPLE_BYTE_CHARACTER_ADDITIONAL_SIZE = 2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const static int UNKNOWN_FORMAT = -1;
|
const static int UNKNOWN_FORMAT = -1;
|
||||||
const static int FORMAT_VERSION_1 = 1;
|
const static int FORMAT_VERSION_1 = 1;
|
||||||
const static uint16_t FORMAT_VERSION_1_MAGIC_NUMBER = 0x78B1;
|
const static uint16_t FORMAT_VERSION_1_MAGIC_NUMBER = 0x78B1;
|
||||||
|
|
|
@ -27,8 +27,7 @@ namespace latinime {
|
||||||
class ProximityInfo;
|
class ProximityInfo;
|
||||||
|
|
||||||
class Correction {
|
class Correction {
|
||||||
|
public:
|
||||||
public:
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TRAVERSE_ALL_ON_TERMINAL,
|
TRAVERSE_ALL_ON_TERMINAL,
|
||||||
TRAVERSE_ALL_NOT_ON_TERMINAL,
|
TRAVERSE_ALL_NOT_ON_TERMINAL,
|
||||||
|
@ -95,7 +94,8 @@ public:
|
||||||
inline int getTreeParentIndex(const int index) const {
|
inline int getTreeParentIndex(const int index) const {
|
||||||
return mCorrectionStates[index].mParentIndex;
|
return mCorrectionStates[index].mParentIndex;
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
|
private:
|
||||||
inline void incrementInputIndex();
|
inline void incrementInputIndex();
|
||||||
inline void incrementOutputIndex();
|
inline void incrementOutputIndex();
|
||||||
inline bool needsToTraverseAllNodes();
|
inline bool needsToTraverseAllNodes();
|
||||||
|
@ -154,7 +154,7 @@ private:
|
||||||
bool mSkipping;
|
bool mSkipping;
|
||||||
|
|
||||||
class RankingAlgorithm {
|
class RankingAlgorithm {
|
||||||
public:
|
public:
|
||||||
static int calculateFinalFreq(const int inputIndex, const int depth,
|
static int calculateFinalFreq(const int inputIndex, const int depth,
|
||||||
const int freq, int *editDistanceTable, const Correction* correction);
|
const int freq, int *editDistanceTable, const Correction* correction);
|
||||||
static int calcFreqForSplitTwoWords(const int firstFreq, const int secondFreq,
|
static int calcFreqForSplitTwoWords(const int firstFreq, const int secondFreq,
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
|
||||||
class Dictionary {
|
class Dictionary {
|
||||||
public:
|
public:
|
||||||
Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultipler,
|
Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, int typedLetterMultipler,
|
||||||
int fullWordMultiplier, int maxWordLength, int maxWords, int maxAlternatives);
|
int fullWordMultiplier, int maxWordLength, int maxWords, int maxAlternatives);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
const int pos, unsigned short *c, int *childrenPosition,
|
const int pos, unsigned short *c, int *childrenPosition,
|
||||||
bool *terminal, int *freq);
|
bool *terminal, int *freq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool hasBigram();
|
bool hasBigram();
|
||||||
|
|
||||||
const unsigned char *mDict;
|
const unsigned char *mDict;
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace latinime {
|
||||||
class Correction;
|
class Correction;
|
||||||
|
|
||||||
class ProximityInfo {
|
class ProximityInfo {
|
||||||
public:
|
public:
|
||||||
static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2 = 10;
|
static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2 = 10;
|
||||||
static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR =
|
static const int NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR =
|
||||||
1 << NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2;
|
1 << NORMALIZED_SQUARED_DISTANCE_SCALING_FACTOR_LOG_2;
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
return mTouchPositionCorrectionEnabled;
|
return mTouchPositionCorrectionEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The max number of the keys in one keyboard layout
|
// The max number of the keys in one keyboard layout
|
||||||
static const int MAX_KEY_COUNT_IN_A_KEYBOARD = 64;
|
static const int MAX_KEY_COUNT_IN_A_KEYBOARD = 64;
|
||||||
// The upper limit of the char code in mCodeToKeyIndex
|
// The upper limit of the char code in mCodeToKeyIndex
|
||||||
|
|
|
@ -29,9 +29,7 @@ namespace latinime {
|
||||||
|
|
||||||
class TerminalAttributes;
|
class TerminalAttributes;
|
||||||
class UnigramDictionary {
|
class UnigramDictionary {
|
||||||
|
public:
|
||||||
public:
|
|
||||||
|
|
||||||
// Mask and flags for children address type selection.
|
// Mask and flags for children address type selection.
|
||||||
static const int MASK_GROUP_ADDRESS_TYPE = 0xC0;
|
static const int MASK_GROUP_ADDRESS_TYPE = 0xC0;
|
||||||
static const int FLAG_GROUP_ADDRESS_TYPE_NOADDRESS = 0x00;
|
static const int FLAG_GROUP_ADDRESS_TYPE_NOADDRESS = 0x00;
|
||||||
|
@ -84,8 +82,7 @@ public:
|
||||||
unsigned short *outWords, int *frequencies);
|
unsigned short *outWords, int *frequencies);
|
||||||
virtual ~UnigramDictionary();
|
virtual ~UnigramDictionary();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void getWordSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
|
void getWordSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
|
||||||
const int *ycoordinates, const int *codes, const int inputLength,
|
const int *ycoordinates, const int *codes, const int inputLength,
|
||||||
const int flags, Correction *correction, WordsPriorityQueuePool *queuePool);
|
const int flags, Correction *correction, WordsPriorityQueuePool *queuePool);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
|
||||||
class WordsPriorityQueue {
|
class WordsPriorityQueue {
|
||||||
public:
|
public:
|
||||||
class SuggestedWord {
|
class SuggestedWord {
|
||||||
public:
|
public:
|
||||||
int mScore;
|
int mScore;
|
||||||
|
@ -126,7 +126,8 @@ public:
|
||||||
mSuggestions.pop();
|
mSuggestions.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
|
private:
|
||||||
struct wordComparator {
|
struct wordComparator {
|
||||||
bool operator ()(SuggestedWord * left, SuggestedWord * right) {
|
bool operator ()(SuggestedWord * left, SuggestedWord * right) {
|
||||||
return left->mScore > right->mScore;
|
return left->mScore > right->mScore;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
|
||||||
class WordsPriorityQueuePool {
|
class WordsPriorityQueuePool {
|
||||||
public:
|
public:
|
||||||
WordsPriorityQueuePool(int mainQueueMaxWords, int subQueueMaxWords, int maxWordLength) {
|
WordsPriorityQueuePool(int mainQueueMaxWords, int subQueueMaxWords, int maxWordLength) {
|
||||||
mMasterQueue = new WordsPriorityQueue(mainQueueMaxWords, maxWordLength);
|
mMasterQueue = new WordsPriorityQueue(mainQueueMaxWords, maxWordLength);
|
||||||
mSubQueue1 = new WordsPriorityQueue(subQueueMaxWords, maxWordLength);
|
mSubQueue1 = new WordsPriorityQueue(subQueueMaxWords, maxWordLength);
|
||||||
|
@ -43,7 +43,8 @@ public:
|
||||||
WordsPriorityQueue* getSubQueue2() {
|
WordsPriorityQueue* getSubQueue2() {
|
||||||
return mSubQueue2;
|
return mSubQueue2;
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
|
private:
|
||||||
WordsPriorityQueue *mMasterQueue;
|
WordsPriorityQueue *mMasterQueue;
|
||||||
WordsPriorityQueue *mSubQueue1;
|
WordsPriorityQueue *mSubQueue1;
|
||||||
WordsPriorityQueue *mSubQueue2;
|
WordsPriorityQueue *mSubQueue2;
|
||||||
|
|
Loading…
Reference in a new issue