am ff981cc3: am 43779c04: Merge "Add method to get dictionary flags from DicTraverseSession"
* commit 'ff981cc3e3169ca0b9af9bf40cd55cd9f95fa63e': Add method to get dictionary flags from DicTraverseSessionmain
commit
6a0f11cc91
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -38,7 +38,7 @@ class UnigramDictionary {
|
|||
static const int FLAG_MULTIPLE_SUGGEST_ABORT = 0;
|
||||
static const int FLAG_MULTIPLE_SUGGEST_SKIP = 1;
|
||||
static const int FLAG_MULTIPLE_SUGGEST_CONTINUE = 2;
|
||||
UnigramDictionary(const uint8_t *const streamStart, const unsigned int flags);
|
||||
UnigramDictionary(const uint8_t *const streamStart, const unsigned int dictFlags);
|
||||
int getProbability(const int *const inWord, const int length) const;
|
||||
int getBigramPosition(int pos, int *word, int offset, int length) const;
|
||||
int getSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
|
||||
|
@ -46,6 +46,7 @@ class UnigramDictionary {
|
|||
const std::map<int, int> *bigramMap, const uint8_t *bigramFilter,
|
||||
const bool useFullEditDistance, int *outWords, int *frequencies,
|
||||
int *outputTypes) const;
|
||||
int getDictFlags() const { return DICT_FLAGS; }
|
||||
virtual ~UnigramDictionary();
|
||||
|
||||
private:
|
||||
|
@ -109,7 +110,7 @@ class UnigramDictionary {
|
|||
const uint8_t *const DICT_ROOT;
|
||||
const int ROOT_POS;
|
||||
const int MAX_DIGRAPH_SEARCH_DEPTH;
|
||||
const int FLAGS;
|
||||
const int DICT_FLAGS;
|
||||
};
|
||||
} // namespace latinime
|
||||
#endif // LATINIME_UNIGRAM_DICTIONARY_H
|
||||
|
|
Loading…
Reference in New Issue