Loading java/src/com/android/inputmethod/latin/SuggestedWords.java +5 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,7 @@ public class SuggestedWords { public static final int KIND_FLAG_POSSIBLY_OFFENSIVE = 0x80000000; public static final int KIND_FLAG_EXACT_MATCH = 0x40000000; public static final int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x20000000; public static final int KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION = 0x10000000; public final String mWord; // The completion info from the application. Null for suggestions that don't come from Loading Loading @@ -333,6 +334,10 @@ public class SuggestedWords { return (mKindAndFlags & KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION) != 0; } public boolean isAprapreateForAutoCorrection() { return (mKindAndFlags & KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION) != 0; } public void setDebugString(final String str) { if (null == str) throw new NullPointerException("Debug info is null"); mDebugString = str; Loading java/src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java +4 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,10 @@ public final class AutoCorrectionUtils { if (suggestion.isKindOf(SuggestedWordInfo.KIND_WHITELIST)) { return true; } // TODO: return suggestion.isAprapreateForAutoCorrection(); if (!suggestion.isAprapreateForAutoCorrection()) { return false; } final int autoCorrectionSuggestionScore = suggestion.mScore; // TODO: when the normalized score of the first suggestion is nearly equals to // the normalized score of the second suggestion, behave less aggressive. Loading native/jni/src/suggest/core/dictionary/dictionary.h +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ class Dictionary { static const int KIND_FLAG_POSSIBLY_OFFENSIVE = 0x80000000; static const int KIND_FLAG_EXACT_MATCH = 0x40000000; static const int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x20000000; static const int KIND_FLAG_APPROPRIATE_FOR_AUTOCORRECTION = 0x10000000; Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::StructurePolicyPtr dictionaryStructureWithBufferPolicy); Loading native/jni/src/suggest/core/dictionary/error_type_utils.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -21,13 +21,14 @@ namespace latinime { const ErrorTypeUtils::ErrorType ErrorTypeUtils::NOT_AN_ERROR = 0x0; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_WRONG_CASE = 0x1; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_MISSING_ACCENT = 0x2; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_WRONG_ACCENT = 0x4; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_DIGRAPH = 0x8; const ErrorTypeUtils::ErrorType ErrorTypeUtils::INTENTIONAL_OMISSION = 0x10; const ErrorTypeUtils::ErrorType ErrorTypeUtils::EDIT_CORRECTION = 0x20; const ErrorTypeUtils::ErrorType ErrorTypeUtils::PROXIMITY_CORRECTION = 0x40; const ErrorTypeUtils::ErrorType ErrorTypeUtils::COMPLETION = 0x80; const ErrorTypeUtils::ErrorType ErrorTypeUtils::NEW_WORD = 0x100; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_MISSING_EXPLICIT_ACCENT = 0x4; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_WRONG_ACCENT = 0x8; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_DIGRAPH = 0x10; const ErrorTypeUtils::ErrorType ErrorTypeUtils::INTENTIONAL_OMISSION = 0x20; const ErrorTypeUtils::ErrorType ErrorTypeUtils::EDIT_CORRECTION = 0x40; const ErrorTypeUtils::ErrorType ErrorTypeUtils::PROXIMITY_CORRECTION = 0x80; const ErrorTypeUtils::ErrorType ErrorTypeUtils::COMPLETION = 0x100; const ErrorTypeUtils::ErrorType ErrorTypeUtils::NEW_WORD = 0x200; const ErrorTypeUtils::ErrorType ErrorTypeUtils::ERRORS_TREATED_AS_AN_EXACT_MATCH = NOT_AN_ERROR | MATCH_WITH_WRONG_CASE | MATCH_WITH_MISSING_ACCENT | MATCH_WITH_DIGRAPH; Loading native/jni/src/suggest/core/dictionary/error_type_utils.h +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class ErrorTypeUtils { static const ErrorType NOT_AN_ERROR; static const ErrorType MATCH_WITH_WRONG_CASE; static const ErrorType MATCH_WITH_MISSING_ACCENT; static const ErrorType MATCH_WITH_MISSING_EXPLICIT_ACCENT; static const ErrorType MATCH_WITH_WRONG_ACCENT; static const ErrorType MATCH_WITH_DIGRAPH; // Treat error as an intentional omission when the CorrectionType is omission and the node can Loading Loading @@ -61,6 +62,10 @@ class ErrorTypeUtils { & ~ERRORS_TREATED_AS_AN_EXACT_MATCH_WITH_INTENTIONAL_OMISSION) == 0; } static bool isMissingExplicitAccent(const ErrorType errorType) { return (errorType & MATCH_WITH_MISSING_EXPLICIT_ACCENT) != 0; } static bool isEditCorrectionError(const ErrorType errorType) { return (errorType & EDIT_CORRECTION) != 0; } Loading Loading
java/src/com/android/inputmethod/latin/SuggestedWords.java +5 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,7 @@ public class SuggestedWords { public static final int KIND_FLAG_POSSIBLY_OFFENSIVE = 0x80000000; public static final int KIND_FLAG_EXACT_MATCH = 0x40000000; public static final int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x20000000; public static final int KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION = 0x10000000; public final String mWord; // The completion info from the application. Null for suggestions that don't come from Loading Loading @@ -333,6 +334,10 @@ public class SuggestedWords { return (mKindAndFlags & KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION) != 0; } public boolean isAprapreateForAutoCorrection() { return (mKindAndFlags & KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION) != 0; } public void setDebugString(final String str) { if (null == str) throw new NullPointerException("Debug info is null"); mDebugString = str; Loading
java/src/com/android/inputmethod/latin/utils/AutoCorrectionUtils.java +4 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,10 @@ public final class AutoCorrectionUtils { if (suggestion.isKindOf(SuggestedWordInfo.KIND_WHITELIST)) { return true; } // TODO: return suggestion.isAprapreateForAutoCorrection(); if (!suggestion.isAprapreateForAutoCorrection()) { return false; } final int autoCorrectionSuggestionScore = suggestion.mScore; // TODO: when the normalized score of the first suggestion is nearly equals to // the normalized score of the second suggestion, behave less aggressive. Loading
native/jni/src/suggest/core/dictionary/dictionary.h +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ class Dictionary { static const int KIND_FLAG_POSSIBLY_OFFENSIVE = 0x80000000; static const int KIND_FLAG_EXACT_MATCH = 0x40000000; static const int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x20000000; static const int KIND_FLAG_APPROPRIATE_FOR_AUTOCORRECTION = 0x10000000; Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::StructurePolicyPtr dictionaryStructureWithBufferPolicy); Loading
native/jni/src/suggest/core/dictionary/error_type_utils.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -21,13 +21,14 @@ namespace latinime { const ErrorTypeUtils::ErrorType ErrorTypeUtils::NOT_AN_ERROR = 0x0; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_WRONG_CASE = 0x1; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_MISSING_ACCENT = 0x2; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_WRONG_ACCENT = 0x4; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_DIGRAPH = 0x8; const ErrorTypeUtils::ErrorType ErrorTypeUtils::INTENTIONAL_OMISSION = 0x10; const ErrorTypeUtils::ErrorType ErrorTypeUtils::EDIT_CORRECTION = 0x20; const ErrorTypeUtils::ErrorType ErrorTypeUtils::PROXIMITY_CORRECTION = 0x40; const ErrorTypeUtils::ErrorType ErrorTypeUtils::COMPLETION = 0x80; const ErrorTypeUtils::ErrorType ErrorTypeUtils::NEW_WORD = 0x100; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_MISSING_EXPLICIT_ACCENT = 0x4; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_WRONG_ACCENT = 0x8; const ErrorTypeUtils::ErrorType ErrorTypeUtils::MATCH_WITH_DIGRAPH = 0x10; const ErrorTypeUtils::ErrorType ErrorTypeUtils::INTENTIONAL_OMISSION = 0x20; const ErrorTypeUtils::ErrorType ErrorTypeUtils::EDIT_CORRECTION = 0x40; const ErrorTypeUtils::ErrorType ErrorTypeUtils::PROXIMITY_CORRECTION = 0x80; const ErrorTypeUtils::ErrorType ErrorTypeUtils::COMPLETION = 0x100; const ErrorTypeUtils::ErrorType ErrorTypeUtils::NEW_WORD = 0x200; const ErrorTypeUtils::ErrorType ErrorTypeUtils::ERRORS_TREATED_AS_AN_EXACT_MATCH = NOT_AN_ERROR | MATCH_WITH_WRONG_CASE | MATCH_WITH_MISSING_ACCENT | MATCH_WITH_DIGRAPH; Loading
native/jni/src/suggest/core/dictionary/error_type_utils.h +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class ErrorTypeUtils { static const ErrorType NOT_AN_ERROR; static const ErrorType MATCH_WITH_WRONG_CASE; static const ErrorType MATCH_WITH_MISSING_ACCENT; static const ErrorType MATCH_WITH_MISSING_EXPLICIT_ACCENT; static const ErrorType MATCH_WITH_WRONG_ACCENT; static const ErrorType MATCH_WITH_DIGRAPH; // Treat error as an intentional omission when the CorrectionType is omission and the node can Loading Loading @@ -61,6 +62,10 @@ class ErrorTypeUtils { & ~ERRORS_TREATED_AS_AN_EXACT_MATCH_WITH_INTENTIONAL_OMISSION) == 0; } static bool isMissingExplicitAccent(const ErrorType errorType) { return (errorType & MATCH_WITH_MISSING_EXPLICIT_ACCENT) != 0; } static bool isEditCorrectionError(const ErrorType errorType) { return (errorType & EDIT_CORRECTION) != 0; } Loading