From aa9187103004d985d102b528a9f3bf69c9e0f852 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 26 Dec 2011 19:04:35 +0900 Subject: [PATCH] Make the dictionary iterator shortcut-aware (B4) Change-Id: I529dff4a50276d1a4f4896c66d1aa35296b21000 --- .../android/inputmethod/latin/BinaryDictInputOutput.java | 3 +-- .../com/android/inputmethod/latin/FusionDictionary.java | 3 +-- tools/makedict/src/com/android/inputmethod/latin/Word.java | 7 ++++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java b/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java index b1d9cc02d..cd77b0a17 100644 --- a/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java +++ b/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java @@ -1003,8 +1003,7 @@ public class BinaryDictInputOutput { new FusionDictionary.DictionaryOptions()); if (null != dict) { for (Word w : dict) { - // TODO: pass the shortcut targets - newDict.add(w.mWord, w.mFrequency, null, w.mBigrams); + newDict.add(w.mWord, w.mFrequency, w.mShortcutTargets, w.mBigrams); } } diff --git a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java b/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java index 2f6b2c371..50def5e62 100644 --- a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java +++ b/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java @@ -592,8 +592,7 @@ public class FusionDictionary implements Iterable { } if (currentGroup.mFrequency >= 0) return new Word(mCurrentString.toString(), currentGroup.mFrequency, - // TODO: pass the shortcut targets here - currentGroup.mBigrams); + currentGroup.mShortcutTargets, currentGroup.mBigrams); } else { mPositions.removeLast(); currentPos = mPositions.getLast(); diff --git a/tools/makedict/src/com/android/inputmethod/latin/Word.java b/tools/makedict/src/com/android/inputmethod/latin/Word.java index 916165a41..561b21bb3 100644 --- a/tools/makedict/src/com/android/inputmethod/latin/Word.java +++ b/tools/makedict/src/com/android/inputmethod/latin/Word.java @@ -28,11 +28,15 @@ import java.util.ArrayList; public class Word implements Comparable { final String mWord; final int mFrequency; + final ArrayList mShortcutTargets; final ArrayList mBigrams; - public Word(String word, int frequency, ArrayList bigrams) { + public Word(final String word, final int frequency, + final ArrayList shortcutTargets, + final ArrayList bigrams) { mWord = word; mFrequency = frequency; + mShortcutTargets = shortcutTargets; mBigrams = bigrams; } @@ -60,6 +64,7 @@ public class Word implements Comparable { if (!(o instanceof Word)) return false; Word w = (Word)o; return mFrequency == w.mFrequency && mWord.equals(w.mWord) + && mShortcutTargets.equals(w.mShortcutTargets) && mBigrams.equals(w.mBigrams); } }