am 47684fb6
: Merge "Using isSkippableChar instead of \'\'\' and \'-\'." into jb-mr1-dev
* commit '47684fb60d6a1812f02836032a71130b7272e746': Using isSkippableChar instead of '\'' and '-'.
This commit is contained in:
commit
5d1c5f9653
4 changed files with 7 additions and 5 deletions
|
@ -631,7 +631,7 @@ Correction::CorrectionType Correction::processCharAndCalcState(
|
||||||
inline static int getQuoteCount(const unsigned short *word, const int length) {
|
inline static int getQuoteCount(const unsigned short *word, const int length) {
|
||||||
int quoteCount = 0;
|
int quoteCount = 0;
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
if (word[i] == '\'') {
|
if (word[i] == SINGLE_QUOTE) {
|
||||||
++quoteCount;
|
++quoteCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,11 @@ namespace latinime {
|
||||||
|
|
||||||
class Correction;
|
class Correction;
|
||||||
|
|
||||||
|
inline bool isSkippableChar(const uint16_t character) {
|
||||||
|
// TODO: Do not hardcode here
|
||||||
|
return character == '\'' || character == '-';
|
||||||
|
}
|
||||||
|
|
||||||
class ProximityInfo {
|
class ProximityInfo {
|
||||||
public:
|
public:
|
||||||
ProximityInfo(JNIEnv *env, const jstring localeJStr, const int maxProximityCharsSize,
|
ProximityInfo(JNIEnv *env, const jstring localeJStr, const int maxProximityCharsSize,
|
||||||
|
|
|
@ -469,9 +469,7 @@ float ProximityInfoState::getPointToKeyLength(const int inputIndex, const int co
|
||||||
const int index = inputIndex * mProximityInfo->getKeyCount() + keyId;
|
const int index = inputIndex * mProximityInfo->getKeyCount() + keyId;
|
||||||
return min(mDistanceCache[index] * scale, mMaxPointToKeyLength);
|
return min(mDistanceCache[index] * scale, mMaxPointToKeyLength);
|
||||||
}
|
}
|
||||||
// TODO: Do not hardcode here
|
if (isSkippableChar(codePoint)) {
|
||||||
// No penalty to ' and -
|
|
||||||
if (codePoint == '\'' || codePoint == '-') {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// If the char is not a key on the keyboard then return the max length.
|
// If the char is not a key on the keyboard then return the max length.
|
||||||
|
|
|
@ -314,7 +314,6 @@ void UnigramDictionary::initSuggestions(ProximityInfo *proximityInfo, const int
|
||||||
correction->initCorrection(proximityInfo, inputSize, maxDepth);
|
correction->initCorrection(proximityInfo, inputSize, maxDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char QUOTE = '\'';
|
|
||||||
static const char SPACE = ' ';
|
static const char SPACE = ' ';
|
||||||
|
|
||||||
void UnigramDictionary::getOneWordSuggestions(ProximityInfo *proximityInfo,
|
void UnigramDictionary::getOneWordSuggestions(ProximityInfo *proximityInfo,
|
||||||
|
|
Loading…
Reference in a new issue