aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java3
-rw-r--r--java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java30
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/PointerTracker.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/ProximityInfo.java10
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java655
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java11
-rw-r--r--java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java137
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java79
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java6
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java40
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java100
12 files changed, 681 insertions, 396 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
index d7cd8e23a..955cb4c42 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibilityEntityProvider.java
@@ -90,6 +90,7 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setPackageName(mKeyboardView.getContext().getPackageName());
event.setClassName(key.getClass().getName());
+ event.setContentDescription(keyDescription);
event.setEnabled(true);
final AccessibilityRecordCompat record = new AccessibilityRecordCompat(event);
@@ -158,12 +159,12 @@ public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat
info = AccessibilityNodeInfoCompat.obtain();
info.setPackageName(mKeyboardView.getContext().getPackageName());
info.setClassName(key.getClass().getName());
+ info.setContentDescription(keyDescription);
info.setBoundsInParent(boundsInParent);
info.setBoundsInScreen(boundsInScreen);
info.setParent(mKeyboardView);
info.setSource(mKeyboardView, virtualViewId);
info.setBoundsInScreen(boundsInScreen);
- info.setText(keyDescription);
info.setEnabled(true);
}
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
index ba814e390..34817ba4e 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java
@@ -23,6 +23,7 @@ import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import com.android.inputmethod.keyboard.Key;
@@ -41,6 +42,12 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
private Key mLastHoverKey = null;
+ /**
+ * Inset in pixels to look for keys when the user's finger exits the
+ * keyboard area. See {@link ViewConfiguration#getScaledEdgeSlop()}.
+ */
+ private int mEdgeSlop;
+
public static void init(InputMethodService inputMethod) {
sInstance.initInternal(inputMethod);
}
@@ -55,6 +62,7 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
private void initInternal(InputMethodService inputMethod) {
mInputMethod = inputMethod;
+ mEdgeSlop = ViewConfiguration.get(inputMethod).getScaledEdgeSlop();
}
/**
@@ -108,8 +116,14 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
mLastHoverKey = key;
switch (event.getAction()) {
- case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_EXIT:
+ // Make sure we're not getting an EXIT event because the user slid
+ // off the keyboard area, then force a key press.
+ if (pointInView(x, y)) {
+ tracker.onRegisterKey(key);
+ }
+ //$FALL-THROUGH$
+ case MotionEvent.ACTION_HOVER_ENTER:
return onHoverKey(key, event);
case MotionEvent.ACTION_HOVER_MOVE:
if (key != previousKey) {
@@ -123,6 +137,20 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
}
/**
+ * Utility method to determine whether the given point, in local
+ * coordinates, is inside the view, where the area of the view is contracted
+ * by the edge slop factor.
+ *
+ * @param localX The local x-coordinate.
+ * @param localY The local y-coordinate.
+ */
+ private boolean pointInView(int localX, int localY) {
+ return (localX >= mEdgeSlop) && (localY >= mEdgeSlop)
+ && (localX < (mView.getWidth() - mEdgeSlop))
+ && (localY < (mView.getHeight() - mEdgeSlop));
+ }
+
+ /**
* Simulates a transition between two {@link Key}s by sending a HOVER_EXIT
* on the previous key, a HOVER_ENTER on the current key, and a HOVER_MOVE
* on the current key.
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index aeca839f1..337ae9c17 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -140,7 +140,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
final PointerTracker tracker = (PointerTracker) msg.obj;
switch (msg.what) {
case MSG_REPEAT_KEY:
- tracker.onRepeatKey(tracker.getKey());
+ tracker.onRegisterKey(tracker.getKey());
startKeyRepeatTimer(tracker, mParams.mKeyRepeatInterval);
break;
case MSG_LONGPRESS_KEY:
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index c62c3ddbc..6ad854d1b 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -714,7 +714,7 @@ public class PointerTracker {
private void startRepeatKey(Key key) {
if (key != null && key.isRepeatable()) {
- onRepeatKey(key);
+ onRegisterKey(key);
mTimerProxy.startKeyRepeatTimer(this);
mIsRepeatableKey = true;
} else {
@@ -722,7 +722,7 @@ public class PointerTracker {
}
}
- public void onRepeatKey(Key key) {
+ public void onRegisterKey(Key key) {
if (key != null) {
detectAndSendKey(key, key.mX, key.mY);
if (!key.altCodeWhileTyping() && !key.isModifier()) {
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index 6b59a8dae..90394ce5e 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -21,7 +21,6 @@ import android.text.TextUtils;
import com.android.inputmethod.keyboard.Keyboard.Params.TouchPositionCorrection;
import com.android.inputmethod.latin.JniUtils;
-import com.android.inputmethod.latin.spellcheck.SpellCheckerProximityInfo;
import java.util.Arrays;
import java.util.HashMap;
@@ -75,15 +74,12 @@ public class ProximityInfo {
return new ProximityInfo("", 1, 1, 1, 1, 1, 1, EMPTY_KEY_ARRAY, null);
}
- public static ProximityInfo createSpellCheckerProximityInfo(final int[] proximity) {
+ public static ProximityInfo createSpellCheckerProximityInfo(final int[] proximity,
+ int rowSize, int gridWidth, int gridHeight) {
final ProximityInfo spellCheckerProximityInfo = createDummyProximityInfo();
spellCheckerProximityInfo.mNativeProximityInfo =
spellCheckerProximityInfo.setProximityInfoNative("",
- SpellCheckerProximityInfo.ROW_SIZE,
- SpellCheckerProximityInfo.PROXIMITY_GRID_WIDTH,
- SpellCheckerProximityInfo.PROXIMITY_GRID_HEIGHT,
- SpellCheckerProximityInfo.PROXIMITY_GRID_WIDTH,
- SpellCheckerProximityInfo.PROXIMITY_GRID_HEIGHT,
+ rowSize, gridWidth, gridHeight, gridWidth, gridHeight,
1, proximity, 0, null, null, null, null, null, null, null, null);
return spellCheckerProximityInfo;
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index 1b516755f..425b5e0bf 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -161,80 +161,79 @@ public final class KeyboardTextsSet {
/* 45 */ "more_keys_for_currency_euro",
/* 46 */ "more_keys_for_currency_pound",
/* 47 */ "more_keys_for_currency_general",
- /* 48 */ "more_keys_for_smiley",
- /* 49 */ "more_keys_for_punctuation",
- /* 50 */ "keyhintlabel_for_punctuation",
- /* 51 */ "more_keys_for_star",
- /* 52 */ "more_keys_for_plus",
- /* 53 */ "more_keys_for_left_parenthesis",
- /* 54 */ "more_keys_for_right_parenthesis",
- /* 55 */ "more_keys_for_less_than",
- /* 56 */ "more_keys_for_greater_than",
- /* 57 */ "keylabel_for_popular_domain",
- /* 58 */ "more_keys_for_popular_domain",
- /* 59 */ "keylabel_for_symbols_1",
- /* 60 */ "keylabel_for_symbols_2",
- /* 61 */ "keylabel_for_symbols_3",
- /* 62 */ "keylabel_for_symbols_4",
- /* 63 */ "keylabel_for_symbols_5",
- /* 64 */ "keylabel_for_symbols_6",
- /* 65 */ "keylabel_for_symbols_7",
- /* 66 */ "keylabel_for_symbols_8",
- /* 67 */ "keylabel_for_symbols_9",
- /* 68 */ "keylabel_for_symbols_0",
- /* 69 */ "additional_more_keys_for_symbols_1",
- /* 70 */ "additional_more_keys_for_symbols_2",
- /* 71 */ "additional_more_keys_for_symbols_3",
- /* 72 */ "additional_more_keys_for_symbols_4",
- /* 73 */ "additional_more_keys_for_symbols_5",
- /* 74 */ "additional_more_keys_for_symbols_6",
- /* 75 */ "additional_more_keys_for_symbols_7",
- /* 76 */ "additional_more_keys_for_symbols_8",
- /* 77 */ "additional_more_keys_for_symbols_9",
- /* 78 */ "additional_more_keys_for_symbols_0",
- /* 79 */ "more_keys_for_symbols_1",
- /* 80 */ "more_keys_for_symbols_2",
- /* 81 */ "more_keys_for_symbols_3",
- /* 82 */ "more_keys_for_symbols_4",
- /* 83 */ "more_keys_for_symbols_5",
- /* 84 */ "more_keys_for_symbols_6",
- /* 85 */ "more_keys_for_symbols_7",
- /* 86 */ "more_keys_for_symbols_8",
- /* 87 */ "more_keys_for_symbols_9",
- /* 88 */ "more_keys_for_symbols_0",
- /* 89 */ "keylabel_for_comma",
- /* 90 */ "more_keys_for_comma",
- /* 91 */ "keylabel_for_symbols_question",
- /* 92 */ "keylabel_for_symbols_semicolon",
- /* 93 */ "keylabel_for_symbols_percent",
- /* 94 */ "more_keys_for_symbols_question",
- /* 95 */ "more_keys_for_symbols_semicolon",
- /* 96 */ "more_keys_for_symbols_percent",
- /* 97 */ "keylabel_for_tablet_comma",
- /* 98 */ "keyhintlabel_for_tablet_comma",
- /* 99 */ "more_keys_for_tablet_comma",
- /* 100 */ "keyhintlabel_for_tablet_period",
- /* 101 */ "more_keys_for_tablet_period",
- /* 102 */ "keylabel_for_apostrophe",
- /* 103 */ "keylabel_for_dash",
- /* 104 */ "keyhintlabel_for_apostrophe",
- /* 105 */ "keyhintlabel_for_dash",
- /* 106 */ "more_keys_for_apostrophe",
- /* 107 */ "more_keys_for_dash",
- /* 108 */ "more_keys_for_bullet",
- /* 109 */ "more_keys_for_am_pm",
- /* 110 */ "settings_as_more_key",
- /* 111 */ "shortcut_as_more_key",
- /* 112 */ "action_next_as_more_key",
- /* 113 */ "action_previous_as_more_key",
- /* 114 */ "label_to_more_symbol_key",
- /* 115 */ "label_to_more_symbol_for_tablet_key",
- /* 116 */ "label_tab_key",
- /* 117 */ "label_to_phone_numeric_key",
- /* 118 */ "label_to_phone_symbols_key",
- /* 119 */ "label_time_am",
- /* 120 */ "label_time_pm",
- /* 121 */ "label_to_symbol_key_pcqwerty",
+ /* 48 */ "more_keys_for_punctuation",
+ /* 49 */ "more_keys_for_star",
+ /* 50 */ "more_keys_for_bullet",
+ /* 51 */ "more_keys_for_plus",
+ /* 52 */ "more_keys_for_left_parenthesis",
+ /* 53 */ "more_keys_for_right_parenthesis",
+ /* 54 */ "more_keys_for_less_than",
+ /* 55 */ "more_keys_for_greater_than",
+ /* 56 */ "keylabel_for_symbols_1",
+ /* 57 */ "keylabel_for_symbols_2",
+ /* 58 */ "keylabel_for_symbols_3",
+ /* 59 */ "keylabel_for_symbols_4",
+ /* 60 */ "keylabel_for_symbols_5",
+ /* 61 */ "keylabel_for_symbols_6",
+ /* 62 */ "keylabel_for_symbols_7",
+ /* 63 */ "keylabel_for_symbols_8",
+ /* 64 */ "keylabel_for_symbols_9",
+ /* 65 */ "keylabel_for_symbols_0",
+ /* 66 */ "additional_more_keys_for_symbols_1",
+ /* 67 */ "additional_more_keys_for_symbols_2",
+ /* 68 */ "additional_more_keys_for_symbols_3",
+ /* 69 */ "additional_more_keys_for_symbols_4",
+ /* 70 */ "additional_more_keys_for_symbols_5",
+ /* 71 */ "additional_more_keys_for_symbols_6",
+ /* 72 */ "additional_more_keys_for_symbols_7",
+ /* 73 */ "additional_more_keys_for_symbols_8",
+ /* 74 */ "additional_more_keys_for_symbols_9",
+ /* 75 */ "additional_more_keys_for_symbols_0",
+ /* 76 */ "more_keys_for_symbols_1",
+ /* 77 */ "more_keys_for_symbols_2",
+ /* 78 */ "more_keys_for_symbols_3",
+ /* 79 */ "more_keys_for_symbols_4",
+ /* 80 */ "more_keys_for_symbols_5",
+ /* 81 */ "more_keys_for_symbols_6",
+ /* 82 */ "more_keys_for_symbols_7",
+ /* 83 */ "more_keys_for_symbols_8",
+ /* 84 */ "more_keys_for_symbols_9",
+ /* 85 */ "more_keys_for_symbols_0",
+ /* 86 */ "keylabel_for_comma",
+ /* 87 */ "more_keys_for_comma",
+ /* 88 */ "keylabel_for_symbols_exclamation",
+ /* 89 */ "keylabel_for_symbols_question",
+ /* 90 */ "keylabel_for_symbols_semicolon",
+ /* 91 */ "keylabel_for_symbols_percent",
+ /* 92 */ "more_keys_for_symbols_exclamation",
+ /* 93 */ "more_keys_for_symbols_question",
+ /* 94 */ "more_keys_for_symbols_semicolon",
+ /* 95 */ "more_keys_for_symbols_percent",
+ /* 96 */ "keylabel_for_tablet_comma",
+ /* 97 */ "keyhintlabel_for_tablet_comma",
+ /* 98 */ "more_keys_for_tablet_comma",
+ /* 99 */ "keyhintlabel_for_tablet_period",
+ /* 100 */ "more_keys_for_tablet_period",
+ /* 101 */ "keylabel_for_apostrophe",
+ /* 102 */ "keyhintlabel_for_apostrophe",
+ /* 103 */ "more_keys_for_apostrophe",
+ /* 104 */ "more_keys_for_am_pm",
+ /* 105 */ "settings_as_more_key",
+ /* 106 */ "shortcut_as_more_key",
+ /* 107 */ "action_next_as_more_key",
+ /* 108 */ "action_previous_as_more_key",
+ /* 109 */ "label_to_more_symbol_key",
+ /* 110 */ "label_to_more_symbol_for_tablet_key",
+ /* 111 */ "label_tab_key",
+ /* 112 */ "label_to_phone_numeric_key",
+ /* 113 */ "label_to_phone_symbols_key",
+ /* 114 */ "label_time_am",
+ /* 115 */ "label_time_pm",
+ /* 116 */ "label_to_symbol_key_pcqwerty",
+ /* 117 */ "keylabel_for_popular_domain",
+ /* 118 */ "more_keys_for_popular_domain",
+ /* 119 */ "more_keys_for_smiley",
+ /* 120 */ "more_keys_for_arabic_diacritics",
};
private static final String EMPTY = "";
@@ -263,19 +262,23 @@ public final class KeyboardTextsSet {
/* 45 */ "\u00A2,\u00A3,$,\u00A5,\u20B1",
/* 46 */ "\u00A2,$,\u20AC,\u00A5,\u20B1",
/* 47 */ "\u00A2,$,\u20AC,\u00A3,\u00A5,\u20B1",
- /* 48 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ",
- /* 49 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,?,@,&,\\%,+,;,/,(,)",
- /* 50 */ EMPTY,
+ /* 48 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\\,,?,@,&,\\%,+,;,/,(,)",
// U+2020: "†" DAGGER
// U+2021: "‡" DOUBLE DAGGER
// U+2605: "★" BLACK STAR
- /* 51 */ "\u2020,\u2021,\u2605",
+ /* 49 */ "\u2020,\u2021,\u2605",
+ // U+266A: "♪" EIGHTH NOTE
+ // U+2665: "♥" BLACK HEART SUIT
+ // U+2660: "♠" BLACK SPADE SUIT
+ // U+2666: "♦" BLACK DIAMOND SUIT
+ // U+2663: "♣" BLACK CLUB SUIT
+ /* 50 */ "\u266A,\u2665,\u2660,\u2666,\u2663",
// U+00B1: "±" PLUS-MINUS SIGN
- /* 52 */ "\u00B1",
+ /* 51 */ "\u00B1",
// The all letters need to be mirrored are found at
// http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt
- /* 53 */ "!fixedColumnOrder!3,<,{,[",
- /* 54 */ "!fixedColumnOrder!3,>,},]",
+ /* 52 */ "!fixedColumnOrder!3,<,{,[",
+ /* 53 */ "!fixedColumnOrder!3,>,},]",
// U+2039: "‹" SINGLE LEFT-POINTING ANGLE QUOTATION MARK
// U+203A: "›" SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
// U+2264: "≤" LESS-THAN OR EQUAL TO
@@ -291,99 +294,110 @@ public final class KeyboardTextsSet {
// U+201D: "”" RIGHT DOUBLE QUOTATION MARK
// U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
// U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK
- /* 55 */ "!fixedColumnOrder!3,\u2039,\u2264,\u00AB",
- /* 56 */ "!fixedColumnOrder!3,\u203A,\u2265,\u00BB",
- /* 57 */ ".com",
- // popular web domains for the locale - most popular, displayed on the keyboard
- /* 58 */ "!hasLabels!,.net,.org,.gov,.edu",
- /* 59 */ "1",
- /* 60 */ "2",
- /* 61 */ "3",
- /* 62 */ "4",
- /* 63 */ "5",
- /* 64 */ "6",
- /* 65 */ "7",
- /* 66 */ "8",
- /* 67 */ "9",
- /* 68 */ "0",
- /* 69~ */
+ /* 54 */ "!fixedColumnOrder!3,\u2039,\u2264,\u00AB",
+ /* 55 */ "!fixedColumnOrder!3,\u203A,\u2265,\u00BB",
+ /* 56 */ "1",
+ /* 57 */ "2",
+ /* 58 */ "3",
+ /* 59 */ "4",
+ /* 60 */ "5",
+ /* 61 */ "6",
+ /* 62 */ "7",
+ /* 63 */ "8",
+ /* 64 */ "9",
+ /* 65 */ "0",
+ /* 66~ */
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
- /* ~78 */
+ /* ~75 */
// U+00B9: "¹" SUPERSCRIPT ONE
// U+00BD: "½" VULGAR FRACTION ONE HALF
// U+2153: "⅓" VULGAR FRACTION ONE THIRD
// U+00BC: "¼" VULGAR FRACTION ONE QUARTER
// U+215B: "⅛" VULGAR FRACTION ONE EIGHTH
- /* 79 */ "\u00B9,\u00BD,\u2153,\u00BC,\u215B",
+ /* 76 */ "\u00B9,\u00BD,\u2153,\u00BC,\u215B",
// U+00B2: "²" SUPERSCRIPT TWO
// U+2154: "⅔" VULGAR FRACTION TWO THIRDS
- /* 80 */ "\u00B2,\u2154",
+ /* 77 */ "\u00B2,\u2154",
// U+00B3: "³" SUPERSCRIPT THREE
// U+00BE: "¾" VULGAR FRACTION THREE QUARTERS
// U+215C: "⅜" VULGAR FRACTION THREE EIGHTHS
- /* 81 */ "\u00B3,\u00BE,\u215C",
+ /* 78 */ "\u00B3,\u00BE,\u215C",
// U+2074: "⁴" SUPERSCRIPT FOUR
- /* 82 */ "\u2074",
+ /* 79 */ "\u2074",
// U+215D: "⅝" VULGAR FRACTION FIVE EIGHTHS
- /* 83 */ "\u215D",
- /* 84 */ EMPTY,
+ /* 80 */ "\u215D",
+ /* 81 */ EMPTY,
// U+215E: "⅞" VULGAR FRACTION SEVEN EIGHTHS
- /* 85 */ "\u215E",
- /* 86 */ EMPTY,
- /* 87 */ EMPTY,
+ /* 82 */ "\u215E",
+ /* 83 */ EMPTY,
+ /* 84 */ EMPTY,
// U+207F: "ⁿ" SUPERSCRIPT LATIN SMALL LETTER N
// U+2205: "∅" EMPTY SET
- /* 88 */ "\u207F,\u2205",
- /* 89 */ ",",
- /* 90 */ EMPTY,
- /* 91 */ "?",
- /* 92 */ ";",
- /* 93 */ "%",
+ /* 85 */ "\u207F,\u2205",
+ /* 86 */ ",",
+ /* 87 */ EMPTY,
+ /* 88 */ "!",
+ /* 89 */ "?",
+ /* 90 */ ";",
+ /* 91 */ "%",
+ // U+00A1: "¡" INVERTED EXCLAMATION MARK
+ /* 92 */ "\u00A1",
// U+00BF: "¿" INVERTED QUESTION MARK
- /* 94 */ "\u00BF",
- /* 95 */ EMPTY,
+ /* 93 */ "\u00BF",
+ /* 94 */ EMPTY,
// U+2030: "‰" PER MILLE SIGN
- /* 96 */ "\u2030",
- /* 97 */ ",",
+ /* 95 */ "\u2030",
+ /* 96 */ ",",
+ /* 97 */ "!",
/* 98 */ "!",
- /* 99 */ "!",
+ /* 99 */ "?",
/* 100 */ "?",
- /* 101 */ "?",
- /* 102 */ "\'",
- /* 103 */ "-",
- /* 104 */ "\"",
- /* 105 */ "_",
- /* 106 */ "\"",
- /* 107 */ "_",
- // U+266A: "♪" EIGHTH NOTE
- // U+2665: "♥" BLACK HEART SUIT
- // U+2660: "♠" BLACK SPADE SUIT
- // U+2666: "♦" BLACK DIAMOND SUIT
- // U+2663: "♣" BLACK CLUB SUIT
- /* 108 */ "\u266A,\u2665,\u2660,\u2666,\u2663",
- /* 109 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm",
- /* 110 */ "!icon/settings_key|!code/key_settings",
- /* 111 */ "!icon/shortcut_key|!code/key_shortcut",
- /* 112 */ "!hasLabels!,!text/label_next_key|!code/key_action_next",
- /* 113 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous",
+ /* 101 */ "\'",
+ /* 102 */ "\"",
+ /* 103 */ "\"",
+ /* 104 */ "!fixedColumnOrder!2,!hasLabels!,!text/label_time_am,!text/label_time_pm",
+ /* 105 */ "!icon/settings_key|!code/key_settings",
+ /* 106 */ "!icon/shortcut_key|!code/key_shortcut",
+ /* 107 */ "!hasLabels!,!text/label_next_key|!code/key_action_next",
+ /* 108 */ "!hasLabels!,!text/label_previous_key|!code/key_action_previous",
// Label for "switch to more symbol" modifier key. Must be short to fit on key!
- /* 114 */ "= \\ <",
+ /* 109 */ "= \\ <",
// Label for "switch to more symbol" modifier key on tablets. Must be short to fit on key!
- /* 115 */ "~ \\ {",
+ /* 110 */ "~ \\ {",
// Label for "Tab" key. Must be short to fit on key!
- /* 116 */ "Tab",
+ /* 111 */ "Tab",
// Label for "switch to phone numeric" key. Must be short to fit on key!
- /* 117 */ "123",
+ /* 112 */ "123",
// Label for "switch to phone symbols" key. Must be short to fit on key!
// U+FF0A: "*" FULLWIDTH ASTERISK
// U+FF03: "#" FULLWIDTH NUMBER SIGN
- /* 118 */ "\uFF0A\uFF03",
+ /* 113 */ "\uFF0A\uFF03",
// Key label for "ante meridiem"
- /* 119 */ "AM",
+ /* 114 */ "AM",
// Key label for "post meridiem"
- /* 120 */ "PM",
+ /* 115 */ "PM",
// Label for "switch to symbols" key on PC QWERTY layout
- /* 121 */ "Sym",
+ /* 116 */ "Sym",
+ /* 117 */ ".com",
+ // popular web domains for the locale - most popular, displayed on the keyboard
+ /* 118 */ "!hasLabels!,.net,.org,.gov,.edu",
+ /* 119 */ "!fixedColumnOrder!5,!hasLabels!,=-O|=-O ,:-P|:-P ,;-)|;-) ,:-(|:-( ,:-)|:-) ,:-!|:-! ,:-$|:-$ ,B-)|B-) ,:O|:O ,:-*|:-* ,:-D|:-D ,:\'(|:\'( ,:-\\\\|:-\\\\ ,O:-)|O:-) ,:-[|:-[ ",
+ // U+064F: "ُ" ARABIC DAMMA
+ // U+064C: "ٌ" ARABIC DAMMATAN
+ // U+0651: "ّ" ARABIC SHADDA
+ // U+0652: "ْ" ARABIC SUKUN
+ // U+0653: "ٓ" ARABIC MADDAH ABOVE
+ // U+064D: "ٍ" ARABIC KASRATAN
+ // U+064B: "ً" ARABIC FATHATAN
+ // U+0650: "ِ" ARABIC KASRA
+ // U+064E: "َ" ARABIC FATHA
+ // U+0640: "ـ" ARABIC TATWEEL
+ // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
+ // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
+ // U+0655: "ٕ" ARABIC HAMZA BELOW
+ // U+0654: "ٔ" ARABIC HAMZA ABOVE
+ // In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label.
+ /* 120 */ "!fixedColumnOrder!5,\u064F,\u064C,\u0651,\u0652,\u0653,\u064D,\u064B,\u0650,\u064E,\u0640\u0640\u0640|\u0640,\u0656,\u0670,\u0655,\u0654",
};
/* Language ar: Arabic */
@@ -400,38 +414,24 @@ public final class KeyboardTextsSet {
// <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB|&#x00AB;;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
/* 43 */ "!fixedColumnOrder!4,\u201C,\u201D,\u00AB|\u00BB,\u00BB|\u00AB,\u2018,\u2019,\u201A,\u201B",
/* 44~ */
- null, null, null, null, null,
- /* ~48 */
+ null, null, null, null,
+ /* ~47 */
// U+061F: "؟" ARABIC QUESTION MARK
// U+060C: "،" ARABIC COMMA
// U+061B: "؛" ARABIC SEMICOLON
- // U+0650: "ِ" ARABIC KASRA
- // U+064E: "َ" ARABIC FATHA
- // U+064D: "ٍ" ARABIC KASRATAN
- // U+064B: "ً" ARABIC FATHATAN
- // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
- // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
- // U+0655: "ٕ" ARABIC HAMZA BELOW
- // U+0654: "ٔ" ARABIC HAMZA ABOVE
- // U+064F: "ُ" ARABIC DAMMA
- // U+064C: "ٌ" ARABIC DAMMATAN
- // U+0651: "ّ" ARABIC SHADDA
- // U+0652: "ْ" ARABIC SUKUN
- // U+0653: "ٓ" ARABIC MADDAH ABOVE
- // U+0640: "ـ" ARABIC TATWEEL
- // In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label.
- /* 49 */ "!fixedColumnOrder!8,\",\',-,:,!,\u061F,\u060C,\u061B,\u0650,\u064E,\u064D,\u064B,\u0656,\u0670,\u0655,\u0654,\u064F,\u064C,\u0651,\u0652,\u0653,\u0640\u0640\u0640|\u0640,/",
- /* 50 */ "\u064B",
+ /* 48 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\u060C,\u061F,@,&,\\%,+,\u061B,/,(,)",
// U+2605: "★" BLACK STAR
// U+066D: "٭" ARABIC FIVE POINTED STAR
- /* 51 */ "\u2605,\u066D",
- /* 52 */ null,
+ /* 49 */ "\u2605,\u066D",
+ // U+266A: "♪" EIGHTH NOTE
+ /* 50 */ "\u266A",
+ /* 51 */ null,
// The all letters need to be mirrored are found at
// http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt
// U+FD3E: "﴾" ORNATE LEFT PARENTHESIS
// U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS
- /* 53 */ "!fixedColumnOrder!4,\uFD3E|\uFD3F,<|>,{|},[|]",
- /* 54 */ "!fixedColumnOrder!4,\uFD3F|\uFD3E,>|<,}|{,]|[",
+ /* 52 */ "!fixedColumnOrder!4,\uFD3E|\uFD3F,<|>,{|},[|]",
+ /* 53 */ "!fixedColumnOrder!4,\uFD3F|\uFD3E,>|<,}|{,]|[",
// U+2264: "≤" LESS-THAN OR EQUAL TO
// U+2265: "≥" GREATER-THAN EQUAL TO
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
@@ -447,85 +447,65 @@ public final class KeyboardTextsSet {
// U+201D: "”" RIGHT DOUBLE QUOTATION MARK
// U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
// U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK
- /* 55 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
- /* 56 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
- /* 57 */ null,
- /* 58 */ null,
+ /* 54 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
+ /* 55 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
// U+0661: "١" ARABIC-INDIC DIGIT ONE
- /* 59 */ "\u0661",
+ /* 56 */ "\u0661",
// U+0662: "٢" ARABIC-INDIC DIGIT TWO
- /* 60 */ "\u0662",
+ /* 57 */ "\u0662",
// U+0663: "٣" ARABIC-INDIC DIGIT THREE
- /* 61 */ "\u0663",
+ /* 58 */ "\u0663",
// U+0664: "٤" ARABIC-INDIC DIGIT FOUR
- /* 62 */ "\u0664",
+ /* 59 */ "\u0664",
// U+0665: "٥" ARABIC-INDIC DIGIT FIVE
- /* 63 */ "\u0665",
+ /* 60 */ "\u0665",
// U+0666: "٦" ARABIC-INDIC DIGIT SIX
- /* 64 */ "\u0666",
+ /* 61 */ "\u0666",
// U+0667: "٧" ARABIC-INDIC DIGIT SEVEN
- /* 65 */ "\u0667",
+ /* 62 */ "\u0667",
// U+0668: "٨" ARABIC-INDIC DIGIT EIGHT
- /* 66 */ "\u0668",
+ /* 63 */ "\u0668",
// U+0669: "٩" ARABIC-INDIC DIGIT NINE
- /* 67 */ "\u0669",
+ /* 64 */ "\u0669",
// U+0660: "٠" ARABIC-INDIC DIGIT ZERO
- /* 68 */ "\u0660",
- /* 69 */ "1",
- /* 70 */ "2",
- /* 71 */ "3",
- /* 72 */ "4",
- /* 73 */ "5",
- /* 74 */ "6",
- /* 75 */ "7",
- /* 76 */ "8",
- /* 77 */ "9",
+ /* 65 */ "\u0660",
+ /* 66 */ "1",
+ /* 67 */ "2",
+ /* 68 */ "3",
+ /* 69 */ "4",
+ /* 70 */ "5",
+ /* 71 */ "6",
+ /* 72 */ "7",
+ /* 73 */ "8",
+ /* 74 */ "9",
// U+066B: "٫" ARABIC DECIMAL SEPARATOR
// U+066C: "٬" ARABIC THOUSANDS SEPARATOR
- /* 78 */ "0,\u066B,\u066C",
- /* 79~ */
+ /* 75 */ "0,\u066B,\u066C",
+ /* 76~ */
null, null, null, null, null, null, null, null, null, null,
- /* ~88 */
+ /* ~85 */
// U+060C: "،" ARABIC COMMA
- /* 89 */ "\u060C",
- /* 90 */ "\\,",
- /* 91 */ "\u061F",
- /* 92 */ "\u061B",
+ /* 86 */ "\u060C",
+ /* 87 */ "\\,",
+ /* 88 */ null,
+ /* 89 */ "\u061F",
+ /* 90 */ "\u061B",
// U+066A: "٪" ARABIC PERCENT SIGN
- /* 93 */ "\u066A",
- /* 94 */ "?",
- /* 95 */ ";",
+ /* 91 */ "\u066A",
+ /* 92 */ null,
+ /* 93 */ "?",
+ /* 94 */ ";",
// U+2030: "‰" PER MILLE SIGN
- /* 96 */ "\\%,\u2030",
- /* 97~ */
+ /* 95 */ "\\%,\u2030",
+ /* 96~ */
null, null, null, null, null,
- /* ~101 */
+ /* ~100 */
// U+060C: "،" ARABIC COMMA
// U+061B: "؛" ARABIC SEMICOLON
// U+061F: "؟" ARABIC QUESTION MARK
- /* 102 */ "\u060C",
- /* 103 */ ".",
- /* 104 */ "\u061F",
- /* 105 */ "\u064B",
- /* 106 */ "\u061F,\u061B,!,:,-,/,\',\"",
- // U+0651: "ّ" ARABIC SHADDA
- // U+0652: "ْ" ARABIC SUKUN
- // U+064C: "ٌ" ARABIC DAMMATAN
- // U+0653: "ٓ" ARABIC MADDAH ABOVE
- // U+064F: "ُ" ARABIC DAMMA
- // U+0650: "ِ" ARABIC KASRA
- // U+064E: "َ" ARABIC FATHA
- // U+064B: "ً" ARABIC FATHATAN
- // U+0640: "ـ" ARABIC TATWEEL
- // U+064D: "ٍ" ARABIC KASRATAN
- // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
- // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
- // U+0654: "ٔ" ARABIC HAMZA ABOVE
- // U+0655: "ٕ" ARABIC HAMZA BELOW
- // In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label.
- /* 107 */ "\u0651,\u0652,\u064C,\u0653,\u064F,\u0650,\u064E,\u064B,\u0640\u0640\u0640|\u0640,\u064D,\u0654,\u0656,\u0655,\u0670",
- // U+266A: "♪" EIGHTH NOTE
- /* 108 */ "\u266A",
+ /* 101 */ "\u060C",
+ /* 102 */ "\u061F",
+ /* 103 */ "\u061F,\u061B,!,:,-,/,\',\"",
};
/* Language be: Belarusian */
@@ -881,11 +861,31 @@ public final class KeyboardTextsSet {
/* 8~ */
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null,
- /* ~48 */
+ null, null, null, null, null, null, null, null, null, null,
+ /* ~47 */
+ // U+00A1: "¡" INVERTED EXCLAMATION MARK
+ // U+00BF: "¿" INVERTED QUESTION MARK
+ /* 48 */ "!fixedColumnOrder!9,\",\',#,-,\u00A1,!,\u00BF,\\,,?,@,&,\\%,+,;,:,/,(,)",
+ /* 49~ */
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null,
+ /* ~87 */
// U+00A1: "¡" INVERTED EXCLAMATION MARK
+ /* 88 */ "\u00A1",
// U+00BF: "¿" INVERTED QUESTION MARK
- /* 49 */ "!fixedColumnOrder!7,#,-,\u00A1,!,\u00BF,\\,,?,\\%,+,;,:,/,(,),@,&,\",\'",
+ /* 89 */ "\u00BF",
+ /* 90 */ null,
+ /* 91 */ null,
+ /* 92 */ "!",
+ /* 93 */ "?",
+ /* 94~ */
+ null, null, null,
+ /* ~96 */
+ /* 97 */ "\u00A1",
+ /* 98 */ "\u00A1,!",
+ /* 99 */ "\u00BF",
+ /* 100 */ "\u00BF,?",
};
/* Language et: Estonian */
@@ -1002,38 +1002,24 @@ public final class KeyboardTextsSet {
// <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB|&#x00AB;;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
/* 43 */ "!fixedColumnOrder!4,\u201C,\u201D,\u00AB|\u00BB,\u00BB|\u00AB,\u2018,\u2019,\u201A,\u201B",
/* 44~ */
- null, null, null, null, null,
- /* ~48 */
+ null, null, null, null,
+ /* ~47 */
// U+061F: "؟" ARABIC QUESTION MARK
// U+060C: "،" ARABIC COMMA
// U+061B: "؛" ARABIC SEMICOLON
- // U+0650: "ِ" ARABIC KASRA
- // U+064E: "َ" ARABIC FATHA
- // U+064D: "ٍ" ARABIC KASRATAN
- // U+064B: "ً" ARABIC FATHATAN
- // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
- // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
- // U+0655: "ٕ" ARABIC HAMZA BELOW
- // U+0654: "ٔ" ARABIC HAMZA ABOVE
- // U+064F: "ُ" ARABIC DAMMA
- // U+064C: "ٌ" ARABIC DAMMATAN
- // U+0651: "ّ" ARABIC SHADDA
- // U+0652: "ْ" ARABIC SUKUN
- // U+0653: "ٓ" ARABIC MADDAH ABOVE
- // U+0640: "ـ" ARABIC TATWEEL
- // In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label.
- /* 49 */ "!fixedColumnOrder!8,\",\',-,:,!,\u061F,\u060C,\u061B,\u0650,\u064E,\u064D,\u064B,\u0656,\u0670,\u0655,\u0654,\u064F,\u064C,\u0651,\u0652,\u0653,\u0640\u0640\u0640|\u0640,/",
- /* 50 */ "\u064B",
+ /* 48 */ "!fixedColumnOrder!8,\",\',#,-,:,!,\u060C,\u061F,@,&,\\%,+,\u061B,/,(,)",
// U+2605: "★" BLACK STAR
// U+066D: "٭" ARABIC FIVE POINTED STAR
- /* 51 */ "\u2605,\u066D",
- /* 52 */ null,
+ /* 49 */ "\u2605,\u066D",
+ // U+266A: "♪" EIGHTH NOTE
+ /* 50 */ "\u266A",
+ /* 51 */ null,
// The all letters need to be mirrored are found at
// http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt
// U+FD3E: "﴾" ORNATE LEFT PARENTHESIS
// U+FD3F: "﴿" ORNATE RIGHT PARENTHESIS
- /* 53 */ "!fixedColumnOrder!4,\uFD3E|\uFD3F,<|>,{|},[|]",
- /* 54 */ "!fixedColumnOrder!4,\uFD3F|\uFD3E,>|<,}|{,]|[",
+ /* 52 */ "!fixedColumnOrder!4,\uFD3E|\uFD3F,<|>,{|},[|]",
+ /* 53 */ "!fixedColumnOrder!4,\uFD3F|\uFD3E,>|<,}|{,]|[",
// U+2264: "≤" LESS-THAN OR EQUAL TO
// U+2265: "≥" GREATER-THAN EQUAL TO
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
@@ -1049,87 +1035,67 @@ public final class KeyboardTextsSet {
// U+201D: "”" RIGHT DOUBLE QUOTATION MARK
// U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
// U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK
- /* 55 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
- /* 56 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
- /* 57 */ null,
- /* 58 */ null,
+ /* 54 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
+ /* 55 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
// U+06F1: "۱" EXTENDED ARABIC-INDIC DIGIT ONE
- /* 59 */ "\u06F1",
+ /* 56 */ "\u06F1",
// U+06F2: "۲" EXTENDED ARABIC-INDIC DIGIT TWO
- /* 60 */ "\u06F2",
+ /* 57 */ "\u06F2",
// U+06F3: "۳" EXTENDED ARABIC-INDIC DIGIT THREE
- /* 61 */ "\u06F3",
+ /* 58 */ "\u06F3",
// U+06F4: "۴" EXTENDED ARABIC-INDIC DIGIT FOUR
- /* 62 */ "\u06F4",
+ /* 59 */ "\u06F4",
// U+06F5: "۵" EXTENDED ARABIC-INDIC DIGIT FIVE
- /* 63 */ "\u06F5",
+ /* 60 */ "\u06F5",
// U+06F6: "۶" EXTENDED ARABIC-INDIC DIGIT SIX
- /* 64 */ "\u06F6",
+ /* 61 */ "\u06F6",
// U+06F7: "۷" EXTENDED ARABIC-INDIC DIGIT SEVEN
- /* 65 */ "\u06F7",
+ /* 62 */ "\u06F7",
// U+06F8: "۸" EXTENDED ARABIC-INDIC DIGIT EIGHT
- /* 66 */ "\u06F8",
+ /* 63 */ "\u06F8",
// U+06F9: "۹" EXTENDED ARABIC-INDIC DIGIT NINE
- /* 67 */ "\u06F9",
+ /* 64 */ "\u06F9",
// U+06F0: "۰" EXTENDED ARABIC-INDIC DIGIT ZERO
- /* 68 */ "\u06F0",
- /* 69 */ "1",
- /* 70 */ "2",
- /* 71 */ "3",
- /* 72 */ "4",
- /* 73 */ "5",
- /* 74 */ "6",
- /* 75 */ "7",
- /* 76 */ "8",
- /* 77 */ "9",
+ /* 65 */ "\u06F0",
+ /* 66 */ "1",
+ /* 67 */ "2",
+ /* 68 */ "3",
+ /* 69 */ "4",
+ /* 70 */ "5",
+ /* 71 */ "6",
+ /* 72 */ "7",
+ /* 73 */ "8",
+ /* 74 */ "9",
// U+066B: "٫" ARABIC DECIMAL SEPARATOR
// U+066C: "٬" ARABIC THOUSANDS SEPARATOR
- /* 78 */ "0,\u066B,\u066C",
- /* 79~ */
+ /* 75 */ "0,\u066B,\u066C",
+ /* 76~ */
null, null, null, null, null, null, null, null, null, null,
- /* ~88 */
+ /* ~85 */
// U+060C: "،" ARABIC COMMA
- /* 89 */ "\u060C",
- /* 90 */ "\\,",
- /* 91 */ "\u061F",
- /* 92 */ "\u061B",
+ /* 86 */ "\u060C",
+ /* 87 */ "\\,",
+ /* 88 */ null,
+ /* 89 */ "\u061F",
+ /* 90 */ "\u061B",
// U+066A: "٪" ARABIC PERCENT SIGN
- /* 93 */ "\u066A",
- /* 94 */ "?",
- /* 95 */ ";",
+ /* 91 */ "\u066A",
+ /* 92 */ null,
+ /* 93 */ "?",
+ /* 94 */ ";",
// U+2030: "‰" PER MILLE SIGN
- /* 96 */ "\\%,\u2030",
+ /* 95 */ "\\%,\u2030",
// U+060C: "،" ARABIC COMMA
// U+061B: "؛" ARABIC SEMICOLON
// U+061F: "؟" ARABIC QUESTION MARK
- /* 97 */ "\u060C",
- /* 98 */ "!",
- /* 99 */ "!,\\,",
- /* 100 */ "\u061F",
- /* 101 */ "\u061F,?",
- /* 102~ */
- null, null, null,
- /* ~104 */
- /* 105 */ "\u064B",
- /* 106 */ "\u061F,\u061B,!,:,-,/,\',\"",
- // U+0651: "ّ" ARABIC SHADDA
- // U+0652: "ْ" ARABIC SUKUN
- // U+064C: "ٌ" ARABIC DAMMATAN
- // U+0653: "ٓ" ARABIC MADDAH ABOVE
- // U+064F: "ُ" ARABIC DAMMA
- // U+0650: "ِ" ARABIC KASRA
- // U+064E: "َ" ARABIC FATHA
- // U+064B: "ً" ARABIC FATHATAN
- // U+0640: "ـ" ARABIC TATWEEL
- // U+064D: "ٍ" ARABIC KASRATAN
- // U+0670: "ٰ" ARABIC LETTER SUPERSCRIPT ALEF
- // U+0656: "ٖ" ARABIC SUBSCRIPT ALEF
- // U+0654: "ٔ" ARABIC HAMZA ABOVE
- // U+0655: "ٕ" ARABIC HAMZA BELOW
- // In order to make Tatweel easily distinguishable from other punctuations, we use consecutive Tatweels only for its displayed label.
- /* 107 */ "\u0651,\u0652,\u064C,\u0653,\u064F,\u0650,\u064E,\u064B,\u0640\u0640\u0640|\u0640,\u064D,\u0654,\u0656,\u0655,_,\u0670",
- // U+266A: "♪" EIGHTH NOTE
- /* 108 */ "\u266A",
+ /* 96 */ "\u060C",
+ /* 97 */ "!",
+ /* 98 */ "!,\\,",
+ /* 99 */ "\u061F",
+ /* 100 */ "\u061F,?",
+ /* 101 */ null,
+ /* 102 */ null,
+ /* 103 */ "\u061F,\u061B,!,:,-,/,\',\"",
};
/* Language fi: Finnish */
@@ -1238,38 +1204,38 @@ public final class KeyboardTextsSet {
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null, null, null,
- /* ~58 */
+ null, null, null, null, null, null, null, null, null, null, null,
+ /* ~55 */
// U+0967: "१" DEVANAGARI DIGIT ONE
- /* 59 */ "\u0967",
+ /* 56 */ "\u0967",
// U+0968: "२" DEVANAGARI DIGIT TWO
- /* 60 */ "\u0968",
+ /* 57 */ "\u0968",
// U+0969: "३" DEVANAGARI DIGIT THREE
- /* 61 */ "\u0969",
+ /* 58 */ "\u0969",
// U+096A: "४" DEVANAGARI DIGIT FOUR
- /* 62 */ "\u096A",
+ /* 59 */ "\u096A",
// U+096B: "५" DEVANAGARI DIGIT FIVE
- /* 63 */ "\u096B",
+ /* 60 */ "\u096B",
// U+096C: "६" DEVANAGARI DIGIT SIX
- /* 64 */ "\u096C",
+ /* 61 */ "\u096C",
// U+096D: "७" DEVANAGARI DIGIT SEVEN
- /* 65 */ "\u096D",
+ /* 62 */ "\u096D",
// U+096E: "८" DEVANAGARI DIGIT EIGHT
- /* 66 */ "\u096E",
+ /* 63 */ "\u096E",
// U+096F: "९" DEVANAGARI DIGIT NINE
- /* 67 */ "\u096F",
+ /* 64 */ "\u096F",
// U+0966: "०" DEVANAGARI DIGIT ZERO
- /* 68 */ "\u0966",
- /* 69 */ "1",
- /* 70 */ "2",
- /* 71 */ "3",
- /* 72 */ "4",
- /* 73 */ "5",
- /* 74 */ "6",
- /* 75 */ "7",
- /* 76 */ "8",
- /* 77 */ "9",
- /* 78 */ "0",
+ /* 65 */ "\u0966",
+ /* 66 */ "1",
+ /* 67 */ "2",
+ /* 68 */ "3",
+ /* 69 */ "4",
+ /* 70 */ "5",
+ /* 71 */ "6",
+ /* 72 */ "7",
+ /* 73 */ "8",
+ /* 74 */ "9",
+ /* 75 */ "0",
};
/* Language hr: Croatian */
@@ -1466,17 +1432,18 @@ public final class KeyboardTextsSet {
// <string name="more_keys_for_tablet_double_quote">!fixedColumnOrder!6,&#x201C;,&#x201D;,&#x201E;,&#x201F;,&#x00AB;|&#x00BB;,&#x00BB|&#x00AB;;,&#x2018;,&#x2019;,&#x201A;,&#x201B;</string>
/* 43 */ "!fixedColumnOrder!4,\u201C,\u201D,\u00AB|\u00BB,\u00BB|\u00AB,\u2018,\u2019,\u201A,\u201B",
/* 44~ */
- null, null, null, null, null, null, null,
- /* ~50 */
+ null, null, null, null, null,
+ /* ~48 */
// U+2605: "★" BLACK STAR
- /* 51 */ "\u2605",
+ /* 49 */ "\u2605",
+ /* 50 */ null,
// U+00B1: "±" PLUS-MINUS SIGN
// U+FB29: "﬩" HEBREW LETTER ALTERNATIVE PLUS SIGN
- /* 52 */ "\u00B1,\uFB29",
+ /* 51 */ "\u00B1,\uFB29",
// The all letters need to be mirrored are found at
// http://www.unicode.org/Public/6.1.0/ucd/BidiMirroring.txt
- /* 53 */ "!fixedColumnOrder!3,<|>,{|},[|]",
- /* 54 */ "!fixedColumnOrder!3,>|<,}|{,]|[",
+ /* 52 */ "!fixedColumnOrder!3,<|>,{|},[|]",
+ /* 53 */ "!fixedColumnOrder!3,>|<,}|{,]|[",
// U+2264: "≤" LESS-THAN OR EQUAL TO
// U+2265: "≥" GREATER-THAN EQUAL TO
// U+00AB: "«" LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
@@ -1492,8 +1459,8 @@ public final class KeyboardTextsSet {
// U+201D: "”" RIGHT DOUBLE QUOTATION MARK
// U+201E: "„" DOUBLE LOW-9 QUOTATION MARK
// U+201F: "‟" DOUBLE HIGH-REVERSED-9 QUOTATION MARK
- /* 55 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
- /* 56 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
+ /* 54 */ "!fixedColumnOrder!3,\u2039|\u203A,\u2264|\u2265,\u00AB|\u00BB",
+ /* 55 */ "!fixedColumnOrder!3,\u203A|\u2039,\u2265|\u2264,\u00BB|\u00AB",
};
/* Language ky: Kirghiz */
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index a644ec0d9..cc20f4294 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -17,6 +17,7 @@
package com.android.inputmethod.latin;
import android.content.Context;
+import android.text.TextUtils;
import com.android.inputmethod.keyboard.ProximityInfo;
@@ -84,6 +85,7 @@ public class BinaryDictionary extends Dictionary {
int typedLetterMultiplier, int fullWordMultiplier, int maxWordLength, int maxWords);
private native void closeNative(long dict);
private native boolean isValidWordNative(long dict, int[] word, int wordLength);
+ private native boolean isValidBigramNative(long dict, int[] word1, int[] word2);
private native int getSuggestionsNative(long dict, long proximityInfo, int[] xCoordinates,
int[] yCoordinates, int[] inputCodes, int codesSize, int[] prevWordForBigrams,
boolean useFullEditDistance, char[] outputChars, int[] scores);
@@ -204,6 +206,15 @@ public class BinaryDictionary extends Dictionary {
return isValidWordNative(mNativeDict, chars, chars.length);
}
+ // TODO: Add a batch process version (isValidBigramMultiple?) to avoid excessive numbers of jni
+ // calls when checking for changes in an entire dictionary.
+ public boolean isValidBigram(CharSequence word1, CharSequence word2) {
+ if (TextUtils.isEmpty(word1) || TextUtils.isEmpty(word2)) return false;
+ int[] chars1 = StringUtils.toCodePointArray(word1.toString());
+ int[] chars2 = StringUtils.toCodePointArray(word2.toString());
+ return isValidBigramNative(mNativeDict, chars1, chars2);
+ }
+
@Override
public synchronized void close() {
closeInternal();
diff --git a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
index 65f97e987..22787c218 100644
--- a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
@@ -18,6 +18,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
+import android.os.SystemClock;
import android.provider.BaseColumns;
import android.provider.ContactsContract.Contacts;
import android.text.TextUtils;
@@ -30,18 +31,27 @@ import java.util.Locale;
public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
private static final String[] PROJECTION = {BaseColumns._ID, Contacts.DISPLAY_NAME,};
+ private static final String[] PROJECTION_ID_ONLY = {BaseColumns._ID};
private static final String TAG = ContactsBinaryDictionary.class.getSimpleName();
private static final String NAME = "contacts";
+ private static boolean DEBUG = false;
+
/**
* Frequency for contacts information into the dictionary
*/
private static final int FREQUENCY_FOR_CONTACTS = 40;
private static final int FREQUENCY_FOR_CONTACTS_BIGRAM = 90;
+ /** The maximum number of contacts that this dictionary supports. */
+ private static final int MAX_CONTACT_COUNT = 10000;
+
private static final int INDEX_NAME = 1;
+ /** The number of contacts in the most recent dictionary rebuild. */
+ static private int sContactCountAtLastRebuild = 0;
+
private ContentObserver mObserver;
/**
@@ -98,6 +108,7 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
+ sContactCountAtLastRebuild = getContactCount();
addWords(cursor);
}
} finally {
@@ -125,15 +136,28 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
private void addWords(Cursor cursor) {
clearFusionDictionary();
- while (!cursor.isAfterLast()) {
+ int count = 0;
+ while (!cursor.isAfterLast() && count < MAX_CONTACT_COUNT) {
String name = cursor.getString(INDEX_NAME);
- if (name != null && -1 == name.indexOf('@')) {
+ if (isValidName(name)) {
addName(name);
+ ++count;
}
cursor.moveToNext();
}
}
+ private int getContactCount() {
+ // TODO: consider switching to a rawQuery("select count(*)...") on the database if
+ // performance is a bottleneck.
+ final Cursor cursor = mContext.getContentResolver().query(
+ Contacts.CONTENT_URI, PROJECTION_ID_ONLY, null, null, null);
+ if (cursor != null) {
+ return cursor.getCount();
+ }
+ return 0;
+ }
+
/**
* Adds the words in a name (e.g., firstname/lastname) to the binary dictionary along with their
* bigrams depending on locale.
@@ -144,16 +168,9 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
// TODO: Better tokenization for non-Latin writing systems
for (int i = 0; i < len; i++) {
if (Character.isLetter(name.codePointAt(i))) {
- int j;
- for (j = i + 1; j < len; j++) {
- final int codePoint = name.codePointAt(j);
- if (!(codePoint == Keyboard.CODE_DASH || codePoint == Keyboard.CODE_SINGLE_QUOTE
- || Character.isLetter(codePoint))) {
- break;
- }
- }
- String word = name.substring(i, j);
- i = j - 1;
+ int end = getWordEndPosition(name, len, i);
+ String word = name.substring(i, end);
+ i = end - 1;
// Don't add single letter words, possibly confuses
// capitalization of i.
final int wordLen = word.codePointCount(0, word.length());
@@ -169,4 +186,100 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
}
}
}
+
+ /**
+ * Returns the index of the last letter in the word, starting from position startIndex.
+ */
+ private static int getWordEndPosition(String string, int len, int startIndex) {
+ int end;
+ int cp = 0;
+ for (end = startIndex + 1; end < len; end += Character.charCount(cp)) {
+ cp = string.codePointAt(end);
+ if (!(cp == Keyboard.CODE_DASH || cp == Keyboard.CODE_SINGLE_QUOTE
+ || Character.isLetter(cp))) {
+ break;
+ }
+ }
+ return end;
+ }
+
+ @Override
+ protected boolean hasContentChanged() {
+ final long startTime = SystemClock.uptimeMillis();
+ final int contactCount = getContactCount();
+ if (contactCount > MAX_CONTACT_COUNT) {
+ // If there are too many contacts then return false. In this rare case it is impossible
+ // to include all of them anyways and the cost of rebuilding the dictionary is too high.
+ // TODO: Sort and check only the MAX_CONTACT_COUNT most recent contacts?
+ return false;
+ }
+ if (contactCount != sContactCountAtLastRebuild) {
+ return true;
+ }
+ // Check all contacts since it's not possible to find out which names have changed.
+ // This is needed because it's possible to receive extraneous onChange events even when no
+ // name has changed.
+ Cursor cursor = mContext.getContentResolver().query(
+ Contacts.CONTENT_URI, PROJECTION, null, null, null);
+ if (cursor != null) {
+ try {
+ if (cursor.moveToFirst()) {
+ while (!cursor.isAfterLast()) {
+ String name = cursor.getString(INDEX_NAME);
+ if (isValidName(name) && !isNameInDictionary(name)) {
+ if (DEBUG) {
+ Log.d(TAG, "Contact name missing: " + name + " (runtime = "
+ + (SystemClock.uptimeMillis() - startTime) + " ms)");
+ }
+ return true;
+ }
+ cursor.moveToNext();
+ }
+ }
+ } finally {
+ cursor.close();
+ }
+ }
+ if (DEBUG) {
+ Log.d(TAG, "No contacts changed. (runtime = " + (SystemClock.uptimeMillis() - startTime)
+ + " ms)");
+ }
+ return false;
+ }
+
+ private static boolean isValidName(String name) {
+ if (name != null && -1 == name.indexOf('@')) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the words in a name are in the current binary dictionary.
+ */
+ private boolean isNameInDictionary(String name) {
+ int len = name.codePointCount(0, name.length());
+ String prevWord = null;
+ for (int i = 0; i < len; i++) {
+ if (Character.isLetter(name.codePointAt(i))) {
+ int end = getWordEndPosition(name, len, i);
+ String word = name.substring(i, end);
+ i = end - 1;
+ final int wordLen = word.codePointCount(0, word.length());
+ if (wordLen < MAX_WORD_LENGTH && wordLen > 1) {
+ if (!TextUtils.isEmpty(prevWord) && mUseFirstLastBigrams) {
+ if (!super.isValidBigramLocked(prevWord, word)) {
+ return false;
+ }
+ } else {
+ if (!super.isValidWordLocked(word)) {
+ return false;
+ }
+ }
+ prevWord = word;
+ }
+ }
+ }
+ return true;
+ }
}
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index 3d89226c0..22d8f24f1 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -96,6 +96,13 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
protected abstract void loadDictionaryAsync();
/**
+ * Indicates that the source dictionary content has changed and a rebuild of the binary file is
+ * required. If it returns false, the next reload will only read the current binary dictionary
+ * from file. Note that the shared binary dictionary is locked when this is called.
+ */
+ protected abstract boolean hasContentChanged();
+
+ /**
* Gets the shared dictionary controller for the given filename.
*/
private static synchronized DictionaryController getSharedDictionaryController(
@@ -148,8 +155,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
* the native side.
*/
public void clearFusionDictionary() {
- mFusionDictionary = new FusionDictionary(new Node(), new FusionDictionary.DictionaryOptions(
- new HashMap<String, String>(), false, false));
+ mFusionDictionary = new FusionDictionary(new Node(),
+ new FusionDictionary.DictionaryOptions(new HashMap<String, String>(), false,
+ false));
}
/**
@@ -224,9 +232,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
protected boolean isValidWordInner(final CharSequence word) {
if (mLocalDictionaryController.tryLock()) {
try {
- if (mBinaryDictionary != null) {
- return mBinaryDictionary.isValidWord(word);
- }
+ return isValidWordLocked(word);
} finally {
mLocalDictionaryController.unlock();
}
@@ -234,6 +240,32 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
return false;
}
+ protected boolean isValidWordLocked(final CharSequence word) {
+ if (mBinaryDictionary == null) return false;
+ return mBinaryDictionary.isValidWord(word);
+ }
+
+ protected boolean isValidBigram(final CharSequence word1, final CharSequence word2) {
+ if (mBinaryDictionary == null) return false;
+ return mBinaryDictionary.isValidBigram(word1, word2);
+ }
+
+ protected boolean isValidBigramInner(final CharSequence word1, final CharSequence word2) {
+ if (mLocalDictionaryController.tryLock()) {
+ try {
+ return isValidBigramLocked(word1, word2);
+ } finally {
+ mLocalDictionaryController.unlock();
+ }
+ }
+ return false;
+ }
+
+ protected boolean isValidBigramLocked(final CharSequence word1, final CharSequence word2) {
+ if (mBinaryDictionary == null) return false;
+ return mBinaryDictionary.isValidBigram(word1, word2);
+ }
+
/**
* Load the current binary dictionary from internal storage in a background thread. If no binary
* dictionary exists, this method will generate one.
@@ -315,12 +347,16 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
}
/**
- * Sets whether or not the dictionary is out of date and requires a reload.
+ * Marks that the dictionary is out of date and requires a reload.
+ *
+ * @param requiresRebuild Indicates that the source dictionary content has changed and a rebuild
+ * of the binary file is required. If not true, the next reload process will only read
+ * the current binary dictionary from file.
*/
- protected void setRequiresReload(final boolean reload) {
- final long time = reload ? SystemClock.uptimeMillis() : 0;
- mSharedDictionaryController.mLastUpdateRequestTime = time;
+ protected void setRequiresReload(final boolean requiresRebuild) {
+ final long time = SystemClock.uptimeMillis();
mLocalDictionaryController.mLastUpdateRequestTime = time;
+ mSharedDictionaryController.mLastUpdateRequestTime = time;
if (DEBUG) {
Log.d(TAG, "Reload request: request=" + time + " update="
+ mSharedDictionaryController.mLastUpdateTime);
@@ -351,21 +387,30 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
if (mSharedDictionaryController.isOutOfDate() || !dictionaryFileExists()) {
// If the shared dictionary file does not exist or is out of date, the first
// instance that acquires the lock will generate a new one.
- mSharedDictionaryController.mLastUpdateTime = time;
- mLocalDictionaryController.mLastUpdateTime = time;
- generateBinaryDictionary();
- loadBinaryDictionary();
- } else if (mLocalDictionaryController.isOutOfDate()) {
- // Otherwise, if only the local dictionary for this instance is out of date, load
- // the shared dictionary from file.
- mLocalDictionaryController.mLastUpdateTime = time;
+ if (hasContentChanged()) {
+ // If the source content has changed, rebuild the binary dictionary.
+ mSharedDictionaryController.mLastUpdateTime = time;
+ generateBinaryDictionary();
+ loadBinaryDictionary();
+ } else {
+ // If not, the reload request was unnecessary so revert LastUpdateRequestTime
+ // to LastUpdateTime.
+ mSharedDictionaryController.mLastUpdateRequestTime =
+ mSharedDictionaryController.mLastUpdateTime;
+ }
+ } else if (mBinaryDictionary == null || mLocalDictionaryController.mLastUpdateTime
+ < mSharedDictionaryController.mLastUpdateTime) {
+ // Otherwise, if the local dictionary is older than the shared dictionary, load the
+ // shared dictionary.
loadBinaryDictionary();
}
+ mLocalDictionaryController.mLastUpdateTime = time;
} finally {
mSharedDictionaryController.unlock();
}
}
+ // TODO: cache the file's existence so that we avoid doing a disk access each time.
private boolean dictionaryFileExists() {
final File file = new File(mContext.getFilesDir(), mFilename);
return file.exists();
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index b7385ed21..70ff69a93 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -635,6 +635,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
Log.d(TAG, "onStartInputView: editorInfo:"
+ String.format("inputType=0x%08x imeOptions=0x%08x",
editorInfo.inputType, editorInfo.imeOptions));
+ Log.d(TAG, "All caps = "
+ + ((editorInfo.inputType & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0)
+ + ", sentence caps = "
+ + ((editorInfo.inputType & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) != 0)
+ + ", word caps = "
+ + ((editorInfo.inputType & InputType.TYPE_TEXT_FLAG_CAP_WORDS) != 0));
}
if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.latinIME_onStartInputViewInternal(editorInfo, mPrefs);
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
index d82d503c4..3c818cc56 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
@@ -174,6 +174,7 @@ public class BinaryDictInputOutput {
private static final int MAX_CHARGROUPS_IN_A_NODE = 0x7FFF; // 32767
private static final int MAX_TERMINAL_FREQUENCY = 255;
+ private static final int MAX_BIGRAM_FREQUENCY = 15;
// Arbitrary limit to how much passes we consider address size compression should
// terminate in. At the time of this writing, our largest dictionary completes
@@ -722,15 +723,17 @@ public class BinaryDictInputOutput {
}
/**
- * Makes the flag value for an attribute.
+ * Makes the flag value for a bigram.
*
- * @param more whether there are more attributes after this one.
- * @param offset the offset of the attribute.
- * @param frequency the frequency of the attribute, 0..15
+ * @param more whether there are more bigrams after this one.
+ * @param offset the offset of the bigram.
+ * @param bigramFrequency the frequency of the bigram, 0..255.
+ * @param unigramFrequency the unigram frequency of the same word, 0..255.
+ * @param word the second bigram, for debugging purposes
* @return the flags
*/
- private static final int makeAttributeFlags(final boolean more, final int offset,
- final int frequency) {
+ private static final int makeBigramFlags(final boolean more, final int offset,
+ int bigramFrequency, final int unigramFrequency, final String word) {
int bigramFlags = (more ? FLAG_ATTRIBUTE_HAS_NEXT : 0)
+ (offset < 0 ? FLAG_ATTRIBUTE_OFFSET_NEGATIVE : 0);
switch (getByteSize(offset)) {
@@ -746,7 +749,21 @@ public class BinaryDictInputOutput {
default:
throw new RuntimeException("Strange offset size");
}
- bigramFlags += frequency & FLAG_ATTRIBUTE_FREQUENCY;
+ if (unigramFrequency > bigramFrequency) {
+ MakedictLog.e("Unigram freq is superior to bigram freq for \"" + word
+ + "\". Bigram freq is " + bigramFrequency + ", unigram freq for "
+ + word + " is " + unigramFrequency);
+ bigramFrequency = unigramFrequency;
+ }
+ // We compute the difference between 255 (which means probability = 1) and the
+ // unigram score. We split this into discrete 16 steps, and this is the value
+ // we store into the 4 bits of the bigrams frequency.
+ final float bigramRatio = (float)(bigramFrequency - unigramFrequency)
+ / (MAX_TERMINAL_FREQUENCY - unigramFrequency);
+ // TODO: if the bigram freq is very close to the unigram frequency, we don't want
+ // to include the bigram in the binary dictionary at all.
+ final int discretizedFrequency = Math.round(bigramRatio * MAX_BIGRAM_FREQUENCY);
+ bigramFlags += discretizedFrequency & FLAG_ATTRIBUTE_FREQUENCY;
return bigramFlags;
}
@@ -854,11 +871,14 @@ public class BinaryDictInputOutput {
final Iterator bigramIterator = group.mBigrams.iterator();
while (bigramIterator.hasNext()) {
final WeightedString bigram = (WeightedString)bigramIterator.next();
- final int addressOfBigram = findAddressOfWord(dict, bigram.mWord);
+ final CharGroup target =
+ FusionDictionary.findWordInTree(dict.mRoot, bigram.mWord);
+ final int addressOfBigram = target.mCachedAddress;
+ final int unigramFrequencyForThisWord = target.mFrequency;
++groupAddress;
final int offset = addressOfBigram - groupAddress;
- int bigramFlags = makeAttributeFlags(bigramIterator.hasNext(), offset,
- bigram.mFrequency);
+ int bigramFlags = makeBigramFlags(bigramIterator.hasNext(), offset,
+ bigram.mFrequency, unigramFrequencyForThisWord, bigram.mWord);
buffer[index++] = (byte)bigramFlags;
final int bigramShift = writeVariableAddress(buffer, index, Math.abs(offset));
index += bigramShift;
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index f41645283..6f7f0c333 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -23,6 +23,7 @@ import android.service.textservice.SpellCheckerService;
import android.text.TextUtils;
import android.util.Log;
import android.util.LruCache;
+import android.view.textservice.SentenceSuggestionsInfo;
import android.view.textservice.SuggestionsInfo;
import android.view.textservice.TextInfo;
@@ -392,7 +393,10 @@ public class AndroidSpellCheckerService extends SpellCheckerService
public DictAndProximity createDictAndProximity(final Locale locale) {
final int script = getScriptFromLocale(locale);
final ProximityInfo proximityInfo = ProximityInfo.createSpellCheckerProximityInfo(
- SpellCheckerProximityInfo.getProximityForScript(script));
+ SpellCheckerProximityInfo.getProximityForScript(script),
+ SpellCheckerProximityInfo.ROW_SIZE,
+ SpellCheckerProximityInfo.PROXIMITY_GRID_WIDTH,
+ SpellCheckerProximityInfo.PROXIMITY_GRID_HEIGHT);
final DictionaryCollection dictionaryCollection =
DictionaryFactory.createDictionaryFromManager(this, locale,
true /* useFullEditDistance */);
@@ -484,6 +488,10 @@ public class AndroidSpellCheckerService extends SpellCheckerService
}
mUnigramSuggestionsInfoCache.put(query, new SuggestionsParams(suggestions, flags));
}
+
+ public void remove(String key) {
+ mUnigramSuggestionsInfoCache.remove(key);
+ }
}
AndroidSpellCheckerSession(final AndroidSpellCheckerService service) {
@@ -566,6 +574,96 @@ public class AndroidSpellCheckerService extends SpellCheckerService
return (letterCount * 4 < length * 3);
}
+ private SentenceSuggestionsInfo fixWronglyInvalidatedWordWithSingleQuote(
+ TextInfo ti, SentenceSuggestionsInfo ssi) {
+ final String typedText = ti.getText();
+ if (!typedText.contains(SINGLE_QUOTE)) {
+ return null;
+ }
+ final int N = ssi.getSuggestionsCount();
+ final ArrayList<Integer> additionalOffsets = new ArrayList<Integer>();
+ final ArrayList<Integer> additionalLengths = new ArrayList<Integer>();
+ final ArrayList<SuggestionsInfo> additionalSuggestionsInfos =
+ new ArrayList<SuggestionsInfo>();
+ for (int i = 0; i < N; ++i) {
+ final SuggestionsInfo si = ssi.getSuggestionsInfoAt(i);
+ final int flags = si.getSuggestionsAttributes();
+ if ((flags & SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY) == 0) {
+ continue;
+ }
+ final int offset = ssi.getOffsetAt(i);
+ final int length = ssi.getLengthAt(i);
+ final String subText = typedText.substring(offset, offset + length);
+ if (!subText.contains(SINGLE_QUOTE)) {
+ continue;
+ }
+ final String[] splitTexts = subText.split(SINGLE_QUOTE, -1);
+ if (splitTexts == null || splitTexts.length <= 1) {
+ continue;
+ }
+ final int splitNum = splitTexts.length;
+ for (int j = 0; j < splitNum; ++j) {
+ final String splitText = splitTexts[j];
+ if (TextUtils.isEmpty(splitText)) {
+ continue;
+ }
+ if (mSuggestionsCache.getSuggestionsFromCache(splitText) == null) {
+ continue;
+ }
+ final int newLength = splitText.length();
+ // Neither RESULT_ATTR_IN_THE_DICTIONARY nor RESULT_ATTR_LOOKS_LIKE_TYPO
+ final int newFlags = 0;
+ final SuggestionsInfo newSi = new SuggestionsInfo(newFlags, EMPTY_STRING_ARRAY);
+ newSi.setCookieAndSequence(si.getCookie(), si.getSequence());
+ if (DBG) {
+ Log.d(TAG, "Override and remove old span over: "
+ + splitText + ", " + offset + "," + newLength);
+ }
+ additionalOffsets.add(offset);
+ additionalLengths.add(newLength);
+ additionalSuggestionsInfos.add(newSi);
+ }
+ }
+ final int additionalSize = additionalOffsets.size();
+ if (additionalSize <= 0) {
+ return null;
+ }
+ final int suggestionsSize = N + additionalSize;
+ final int[] newOffsets = new int[suggestionsSize];
+ final int[] newLengths = new int[suggestionsSize];
+ final SuggestionsInfo[] newSuggestionsInfos = new SuggestionsInfo[suggestionsSize];
+ int i;
+ for (i = 0; i < N; ++i) {
+ newOffsets[i] = ssi.getOffsetAt(i);
+ newLengths[i] = ssi.getLengthAt(i);
+ newSuggestionsInfos[i] = ssi.getSuggestionsInfoAt(i);
+ }
+ for (; i < suggestionsSize; ++i) {
+ newOffsets[i] = additionalOffsets.get(i - N);
+ newLengths[i] = additionalLengths.get(i - N);
+ newSuggestionsInfos[i] = additionalSuggestionsInfos.get(i - N);
+ }
+ return new SentenceSuggestionsInfo(newSuggestionsInfos, newOffsets, newLengths);
+ }
+
+ @Override
+ public SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple(
+ TextInfo[] textInfos, int suggestionsLimit) {
+ final SentenceSuggestionsInfo[] retval = super.onGetSentenceSuggestionsMultiple(
+ textInfos, suggestionsLimit);
+ if (retval == null || retval.length != textInfos.length) {
+ return retval;
+ }
+ for (int i = 0; i < retval.length; ++i) {
+ final SentenceSuggestionsInfo tempSsi =
+ fixWronglyInvalidatedWordWithSingleQuote(textInfos[i], retval[i]);
+ if (tempSsi != null) {
+ retval[i] = tempSsi;
+ }
+ }
+ return retval;
+ }
+
// Note : this must be reentrant
/**
* Gets a list of suggestions for a specific string. This returns a list of possible