Allow for non-starting letters to be upper case in dictionary lookup.
Add lowercase optimization to user dictionary as well.main
parent
4dfe799602
commit
f115088924
|
@ -147,16 +147,14 @@ Dictionary::addWord(unsigned short *word, int length, int frequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short
|
unsigned short
|
||||||
Dictionary::toLowerCase(unsigned short c, const int depth) {
|
Dictionary::toLowerCase(unsigned short c) {
|
||||||
if (c < sizeof(BASE_CHARS) / sizeof(BASE_CHARS[0])) {
|
if (c < sizeof(BASE_CHARS) / sizeof(BASE_CHARS[0])) {
|
||||||
c = BASE_CHARS[c];
|
c = BASE_CHARS[c];
|
||||||
}
|
}
|
||||||
if (depth == 0) {
|
if (c >='A' && c <= 'Z') {
|
||||||
if (c >='A' && c <= 'Z') {
|
c |= 32;
|
||||||
c |= 32;
|
} else if (c > 127) {
|
||||||
} else if (c > 127) {
|
c = u_tolower(c);
|
||||||
c = u_tolower(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +199,7 @@ Dictionary::getWordsRec(int pos, int depth, int maxDepth, bool completion, int s
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
unsigned short c = getChar(&pos);
|
unsigned short c = getChar(&pos);
|
||||||
unsigned short lowerC = toLowerCase(c, depth);
|
unsigned short lowerC = toLowerCase(c);
|
||||||
bool terminal = getTerminal(&pos);
|
bool terminal = getTerminal(&pos);
|
||||||
int childrenAddress = getAddress(&pos);
|
int childrenAddress = getAddress(&pos);
|
||||||
int freq = 1;
|
int freq = 1;
|
||||||
|
|
|
@ -49,7 +49,7 @@ private:
|
||||||
|
|
||||||
bool sameAsTyped(unsigned short *word, int length);
|
bool sameAsTyped(unsigned short *word, int length);
|
||||||
bool addWord(unsigned short *word, int length, int frequency);
|
bool addWord(unsigned short *word, int length, int frequency);
|
||||||
unsigned short toLowerCase(unsigned short c, int depth);
|
unsigned short toLowerCase(unsigned short c);
|
||||||
void getWordsRec(int pos, int depth, int maxDepth, bool completion, int frequency,
|
void getWordsRec(int pos, int depth, int maxDepth, bool completion, int frequency,
|
||||||
int inputIndex, int diffs);
|
int inputIndex, int diffs);
|
||||||
bool isValidWordRec(int pos, unsigned short *word, int offset, int length);
|
bool isValidWordRec(int pos, unsigned short *word, int offset, int length);
|
||||||
|
|
|
@ -250,7 +250,11 @@ public class ExpandableDictionary extends Dictionary {
|
||||||
if (c < BASE_CHARS.length) {
|
if (c < BASE_CHARS.length) {
|
||||||
c = BASE_CHARS[c];
|
c = BASE_CHARS[c];
|
||||||
}
|
}
|
||||||
c = Character.toLowerCase(c);
|
if (c >= 'A' && c <= 'Z') {
|
||||||
|
c = (char) (c | 32);
|
||||||
|
} else {
|
||||||
|
c = Character.toLowerCase(c);
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue