mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "Change the formula of the missing character."
This commit is contained in:
commit
47d2ef69d3
@ -138,7 +138,8 @@ static void prof_out(void) {
|
|||||||
#define SUGGEST_WORDS_WITH_SPACE_PROXIMITY true
|
#define SUGGEST_WORDS_WITH_SPACE_PROXIMITY true
|
||||||
|
|
||||||
// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
|
// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
|
||||||
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 70
|
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 90
|
||||||
|
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X 12
|
||||||
#define WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE 80
|
#define WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE 80
|
||||||
#define WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE 75
|
#define WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE 75
|
||||||
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
|
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
|
||||||
|
@ -518,9 +518,12 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int
|
|||||||
// TODO: Demote by edit distance
|
// TODO: Demote by edit distance
|
||||||
int finalFreq = freq * matchWeight;
|
int finalFreq = freq * matchWeight;
|
||||||
if (skipPos >= 0) {
|
if (skipPos >= 0) {
|
||||||
if (mInputLength >= 3) {
|
if (mInputLength >= 2) {
|
||||||
multiplyRate(WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE *
|
const int demotionRate = WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE
|
||||||
(mInputLength - 2) / (mInputLength - 1), &finalFreq);
|
* (10 * mInputLength - WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X)
|
||||||
|
/ (10 * mInputLength
|
||||||
|
- WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X + 10);
|
||||||
|
multiplyRate(demotionRate, &finalFreq);
|
||||||
} else {
|
} else {
|
||||||
finalFreq = 0;
|
finalFreq = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user