Stop avoiding adding what the user typed to candidates

There does not seem to be any reason other than a historical
one to avoid doing this, but it takes processing power and
makes things more complicated.

This has a very limited impact on regression tests:
5 -> 3 [He,           the]
5 -> 3 [An,           an]
5 -> 3 [Where,        where]
5 -> 3 [This,         this]
7 -> 1 [wAtch,        watch]
6 -> 4 [oveNs,        oceans]
5 -> 1 [Ahere,        Where]
7 -> 1 [Hast,         Hast]
7 -> 5 [bjp,          bill]
5 -> 1 [What,         What]
5 -> 3 [Sound,        So und]
7 -> 3 [causalities,  casualties]
7 -> 3 [discontentment, discontent]
7 -> 3 [irregardless, regardless]

5 -> 1 : 2
5 -> 3 : 5
6 -> 4 : 1
7 -> 1 : 2
7 -> 3 : 3
7 -> 5 : 1

+1       4
-1       0
+2       0
-2       0
+3       8
-3       0
+4       1
-4       0
+5       1
-5       7
+6       0
-6       1
+7       0
-7       6

Change-Id: I6407cf922f27bbd3992df11d63690e71fc61111b
main
Jean Chalard 2012-01-16 18:48:19 +09:00
parent d64b8c97fe
commit 82ddd16889
3 changed files with 4 additions and 3 deletions

View File

@ -168,8 +168,8 @@ int Correction::getFinalFreq(const int freq, unsigned short **word, int *wordLen
const int outputIndex = mTerminalOutputIndex;
const int inputIndex = mTerminalInputIndex;
*wordLength = outputIndex + 1;
if (mProximityInfo->sameAsTyped(mWord, outputIndex + 1) || outputIndex < MIN_SUGGEST_DEPTH) {
return -1;
if (outputIndex < MIN_SUGGEST_DEPTH) {
return NOT_A_FREQUENCY;
}
*word = mWord;

View File

@ -172,6 +172,7 @@ static void prof_out(void) {
#define EQUIVALENT_CHAR_WITHOUT_DISTANCE_INFO -2
#define PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO -3
#define NOT_A_INDEX -1
#define NOT_A_FREQUENCY -1
#define KEYCODE_SPACE ' '

View File

@ -335,7 +335,7 @@ inline void UnigramDictionary::onTerminal(const int freq,
int wordLength;
unsigned short* wordPointer;
const int finalFreq = correction->getFinalFreq(freq, &wordPointer, &wordLength);
if (finalFreq >= 0) {
if (finalFreq != NOT_A_FREQUENCY) {
if (!terminalAttributes.isShortcutOnly()) {
if (addToMasterQueue) {
addWord(wordPointer, wordLength, finalFreq, masterQueue);