Save the flags in a member in the unigram dictionary.
Change-Id: Ic8fad9110db6b97f98ace27af0f347b4e69de8c8main
parent
e81ac8baa0
commit
cd274b1469
|
@ -41,8 +41,9 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
|
||||||
mWordsPriorityQueuePool = new WordsPriorityQueuePool(
|
mWordsPriorityQueuePool = new WordsPriorityQueuePool(
|
||||||
maxWords, SUB_QUEUE_MAX_WORDS, maxWordLength);
|
maxWords, SUB_QUEUE_MAX_WORDS, maxWordLength);
|
||||||
const unsigned int headerSize = BinaryFormat::getHeaderSize(mDict);
|
const unsigned int headerSize = BinaryFormat::getHeaderSize(mDict);
|
||||||
|
const unsigned int options = BinaryFormat::getFlags(mDict);
|
||||||
mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
|
mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
|
||||||
fullWordMultiplier, maxWordLength, maxWords);
|
fullWordMultiplier, maxWordLength, maxWords, options);
|
||||||
mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, this);
|
mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,13 +40,13 @@ const UnigramDictionary::digraph_t UnigramDictionary::FRENCH_LIGATURES_DIGRAPHS[
|
||||||
|
|
||||||
// TODO: check the header
|
// TODO: check the header
|
||||||
UnigramDictionary::UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultiplier,
|
UnigramDictionary::UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultiplier,
|
||||||
int fullWordMultiplier, int maxWordLength, int maxWords)
|
int fullWordMultiplier, int maxWordLength, int maxWords, const unsigned int flags)
|
||||||
: DICT_ROOT(streamStart), MAX_WORD_LENGTH(maxWordLength), MAX_WORDS(maxWords),
|
: DICT_ROOT(streamStart), MAX_WORD_LENGTH(maxWordLength), MAX_WORDS(maxWords),
|
||||||
TYPED_LETTER_MULTIPLIER(typedLetterMultiplier), FULL_WORD_MULTIPLIER(fullWordMultiplier),
|
TYPED_LETTER_MULTIPLIER(typedLetterMultiplier), FULL_WORD_MULTIPLIER(fullWordMultiplier),
|
||||||
// TODO : remove this variable.
|
// TODO : remove this variable.
|
||||||
ROOT_POS(0),
|
ROOT_POS(0),
|
||||||
BYTES_IN_ONE_CHAR(sizeof(int)),
|
BYTES_IN_ONE_CHAR(sizeof(int)),
|
||||||
MAX_DIGRAPH_SEARCH_DEPTH(DEFAULT_MAX_DIGRAPH_SEARCH_DEPTH) {
|
MAX_DIGRAPH_SEARCH_DEPTH(DEFAULT_MAX_DIGRAPH_SEARCH_DEPTH), FLAGS(flags) {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
AKLOGI("UnigramDictionary - constructor");
|
AKLOGI("UnigramDictionary - constructor");
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class UnigramDictionary {
|
||||||
static const int MAX_ERRORS_FOR_TWO_WORDS = 1;
|
static const int MAX_ERRORS_FOR_TWO_WORDS = 1;
|
||||||
|
|
||||||
UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultipler,
|
UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultipler,
|
||||||
int fullWordMultiplier, int maxWordLength, int maxWords);
|
int fullWordMultiplier, int maxWordLength, int maxWords, const unsigned int flags);
|
||||||
bool isValidWord(const uint16_t* const inWord, const int length) const;
|
bool isValidWord(const uint16_t* const inWord, const int length) const;
|
||||||
int getBigramPosition(int pos, unsigned short *word, int offset, int length) const;
|
int getBigramPosition(int pos, unsigned short *word, int offset, int length) const;
|
||||||
int getSuggestions(ProximityInfo *proximityInfo, WordsPriorityQueuePool *queuePool,
|
int getSuggestions(ProximityInfo *proximityInfo, WordsPriorityQueuePool *queuePool,
|
||||||
|
@ -143,6 +143,7 @@ class UnigramDictionary {
|
||||||
const int ROOT_POS;
|
const int ROOT_POS;
|
||||||
const unsigned int BYTES_IN_ONE_CHAR;
|
const unsigned int BYTES_IN_ONE_CHAR;
|
||||||
const int MAX_DIGRAPH_SEARCH_DEPTH;
|
const int MAX_DIGRAPH_SEARCH_DEPTH;
|
||||||
|
const int FLAGS;
|
||||||
|
|
||||||
// Flags for special processing
|
// Flags for special processing
|
||||||
// Those *must* match the flags in BinaryDictionary.Flags.ALL_FLAGS in BinaryDictionary.java
|
// Those *must* match the flags in BinaryDictionary.Flags.ALL_FLAGS in BinaryDictionary.java
|
||||||
|
|
Loading…
Reference in New Issue