Remove write-only stuff

Change-Id: I5ac8ab64c77a298502b3d063ea70db9b4da41716
main
Jean Chalard 2012-04-06 17:52:18 +09:00
parent 1ec1be46b8
commit 5b0761e6a9
7 changed files with 8 additions and 23 deletions

View File

@ -26,11 +26,8 @@
namespace latinime {
BigramDictionary::BigramDictionary(const unsigned char *dict, int maxWordLength,
const bool isLatestDictVersion, const bool hasBigram,
Dictionary *parentDictionary)
: DICT(dict), MAX_WORD_LENGTH(maxWordLength),
IS_LATEST_DICT_VERSION(isLatestDictVersion),
HAS_BIGRAM(hasBigram), mParentDictionary(parentDictionary) {
: DICT(dict), MAX_WORD_LENGTH(maxWordLength), mParentDictionary(parentDictionary) {
if (DEBUG_DICT) {
AKLOGI("BigramDictionary - constructor");
AKLOGI("Has Bigram : %d", hasBigram);

View File

@ -22,8 +22,7 @@ namespace latinime {
class Dictionary;
class BigramDictionary {
public:
BigramDictionary(const unsigned char *dict, int maxWordLength,
const bool isLatestDictVersion, const bool hasBigram, Dictionary *parentDictionary);
BigramDictionary(const unsigned char *dict, int maxWordLength, Dictionary *parentDictionary);
int getBigrams(unsigned short *word, int length, int *codes, int codesSize,
unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams);
~BigramDictionary();
@ -40,8 +39,6 @@ class BigramDictionary {
const int MAX_WORD_LENGTH;
// TODO: Re-implement proximity correction for bigram correction
static const int MAX_ALTERNATIVES = 1;
const bool IS_LATEST_DICT_VERSION;
const bool HAS_BIGRAM;
Dictionary *mParentDictionary;
int *mBigramFreq;

View File

@ -81,7 +81,7 @@ inline int BinaryFormat::detectFormat(const uint8_t* const dict) {
// Format 2 header is as follows:
// Magic number (4 bytes) 0x9B 0xC1 0x3A 0xFE
// Version number (2 bytes) 0x00 0x02
// Options (2 bytes) must be 0x00 0x00
// Options (2 bytes)
// Header size (4 bytes) : integer, big endian
return (dict[4] << 8) + dict[5];
default:

View File

@ -29,9 +29,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
int typedLetterMultiplier, int fullWordMultiplier,
int maxWordLength, int maxWords)
: mDict((unsigned char*) dict), mDictSize(dictSize),
mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust),
// Checks whether it has the latest dictionary or the old dictionary
IS_LATEST_DICT_VERSION((((unsigned char*) dict)[0] & 0xFF) >= DICTIONARY_VERSION_MIN) {
mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust) {
if (DEBUG_DICT) {
if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) {
AKLOGI("Max word length (%d) is greater than %d",
@ -44,9 +42,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
maxWords, SUB_QUEUE_MAX_WORDS, maxWordLength);
const unsigned int headerSize = BinaryFormat::getHeaderSize(mDict);
mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier,
fullWordMultiplier, maxWordLength, maxWords, IS_LATEST_DICT_VERSION);
mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength,
IS_LATEST_DICT_VERSION, true /* hasBigram */, this);
fullWordMultiplier, maxWordLength, maxWords);
mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength, this);
}
Dictionary::~Dictionary() {

View File

@ -39,7 +39,6 @@ class Dictionary {
codesSize, flags, outWords, frequencies);
}
// TODO: Call mBigramDictionary instead of mUnigramDictionary
int getBigrams(unsigned short *word, int length, int *codes, int codesSize,
unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) {
return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies,
@ -68,7 +67,6 @@ class Dictionary {
const int mMmapFd;
const int mDictBufAdjust;
const bool IS_LATEST_DICT_VERSION;
UnigramDictionary *mUnigramDictionary;
BigramDictionary *mBigramDictionary;
WordsPriorityQueuePool *mWordsPriorityQueuePool;

View File

@ -40,10 +40,8 @@ const UnigramDictionary::digraph_t UnigramDictionary::FRENCH_LIGATURES_DIGRAPHS[
// TODO: check the header
UnigramDictionary::UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultiplier,
int fullWordMultiplier, int maxWordLength, int maxWords,
const bool isLatestDictVersion)
int fullWordMultiplier, int maxWordLength, int maxWords)
: DICT_ROOT(streamStart), MAX_WORD_LENGTH(maxWordLength), MAX_WORDS(maxWords),
IS_LATEST_DICT_VERSION(isLatestDictVersion),
TYPED_LETTER_MULTIPLIER(typedLetterMultiplier), FULL_WORD_MULTIPLIER(fullWordMultiplier),
// TODO : remove this variable.
ROOT_POS(0),

View File

@ -70,8 +70,7 @@ class UnigramDictionary {
static const int MAX_ERRORS_FOR_TWO_WORDS = 1;
UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultipler,
int fullWordMultiplier, int maxWordLength, int maxWords,
const bool isLatestDictVersion);
int fullWordMultiplier, int maxWordLength, int maxWords);
bool isValidWord(const uint16_t* const inWord, const int length) const;
int getBigramPosition(int pos, unsigned short *word, int offset, int length) const;
int getSuggestions(ProximityInfo *proximityInfo, WordsPriorityQueuePool *queuePool,
@ -139,7 +138,6 @@ class UnigramDictionary {
const uint8_t* const DICT_ROOT;
const int MAX_WORD_LENGTH;
const int MAX_WORDS;
const bool IS_LATEST_DICT_VERSION;
const int TYPED_LETTER_MULTIPLIER;
const int FULL_WORD_MULTIPLIER;
const int ROOT_POS;