mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Remove a constant parameter (A105)
Change-Id: I8a09fa2f0649880c943364699a07652e47dede22
This commit is contained in:
parent
b7d7c5a369
commit
1a69ad5a10
@ -38,7 +38,7 @@ BigramDictionary::~BigramDictionary() {
|
||||
}
|
||||
|
||||
bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequency,
|
||||
const int maxBigrams, int *bigramFreq, unsigned short *bigramChars) const {
|
||||
int *bigramFreq, unsigned short *bigramChars) const {
|
||||
word[length] = 0;
|
||||
if (DEBUG_DICT) {
|
||||
#ifdef FLAG_DBG
|
||||
@ -50,7 +50,7 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ
|
||||
|
||||
// Find the right insertion point
|
||||
int insertAt = 0;
|
||||
while (insertAt < maxBigrams) {
|
||||
while (insertAt < MAX_PREDICTIONS) {
|
||||
if (frequency > bigramFreq[insertAt] || (bigramFreq[insertAt] == frequency
|
||||
&& length < Dictionary::wideStrLen(bigramChars + insertAt * MAX_WORD_LENGTH))) {
|
||||
break;
|
||||
@ -58,16 +58,16 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ
|
||||
insertAt++;
|
||||
}
|
||||
if (DEBUG_DICT) {
|
||||
AKLOGI("Bigram: InsertAt -> %d maxBigrams: %d", insertAt, maxBigrams);
|
||||
AKLOGI("Bigram: InsertAt -> %d MAX_PREDICTIONS: %d", insertAt, MAX_PREDICTIONS);
|
||||
}
|
||||
if (insertAt < maxBigrams) {
|
||||
if (insertAt < MAX_PREDICTIONS) {
|
||||
memmove((char*) bigramFreq + (insertAt + 1) * sizeof(bigramFreq[0]),
|
||||
(char*) bigramFreq + insertAt * sizeof(bigramFreq[0]),
|
||||
(maxBigrams - insertAt - 1) * sizeof(bigramFreq[0]));
|
||||
(MAX_PREDICTIONS - insertAt - 1) * sizeof(bigramFreq[0]));
|
||||
bigramFreq[insertAt] = frequency;
|
||||
memmove((char*) bigramChars + (insertAt + 1) * MAX_WORD_LENGTH * sizeof(short),
|
||||
(char*) bigramChars + (insertAt ) * MAX_WORD_LENGTH * sizeof(short),
|
||||
(maxBigrams - insertAt - 1) * sizeof(short) * MAX_WORD_LENGTH);
|
||||
(MAX_PREDICTIONS - insertAt - 1) * sizeof(short) * MAX_WORD_LENGTH);
|
||||
unsigned short *dest = bigramChars + (insertAt ) * MAX_WORD_LENGTH;
|
||||
while (length--) {
|
||||
*dest++ = *word++;
|
||||
@ -137,7 +137,7 @@ int BigramDictionary::getBigrams(const int32_t *prevWord, int prevWordLength, in
|
||||
const int frequency =
|
||||
BinaryFormat::computeFrequencyForBigram(unigramFreq, bigramFreqTemp);
|
||||
if (addWordBigram(
|
||||
bigramBuffer, length, frequency, maxBigrams, bigramFreq, bigramChars)) {
|
||||
bigramBuffer, length, frequency, bigramFreq, bigramChars)) {
|
||||
++bigramCount;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class BigramDictionary {
|
||||
~BigramDictionary();
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(BigramDictionary);
|
||||
bool addWordBigram(unsigned short *word, int length, int frequency, const int maxBigrams,
|
||||
bool addWordBigram(unsigned short *word, int length, int frequency,
|
||||
int *bigramFreq, unsigned short *bigramChars) const;
|
||||
int getBigramAddress(int *pos, bool advance);
|
||||
int getBigramFreq(int *pos);
|
||||
|
Loading…
Reference in New Issue
Block a user