aboutsummaryrefslogtreecommitdiffstats
path: root/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-12-26 19:00:00 +0900
committerJean Chalard <jchalard@google.com>2012-01-05 19:11:02 +0900
commiteec2e51e2cbc9e69739187557846a439ed74325e (patch)
treeff2a38b9df6075f71e4df5fd8907406a12fe53bb /tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
parent3b161b2526ee7f867c887462dc826d2edc118f3d (diff)
downloadlatinime-eec2e51e2cbc9e69739187557846a439ed74325e.tar.gz
latinime-eec2e51e2cbc9e69739187557846a439ed74325e.tar.xz
latinime-eec2e51e2cbc9e69739187557846a439ed74325e.zip
Add shortcut support to the in-memory format of makedict (B3)
Change-Id: Icb8427c82694e24c8d08a5376157c7d1444af979
Diffstat (limited to 'tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java')
-rw-r--r--tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java b/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
index 92f402d3e..b1d9cc02d 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
+++ b/tools/makedict/src/com/android/inputmethod/latin/BinaryDictInputOutput.java
@@ -44,8 +44,9 @@ public class BinaryDictInputOutput {
* a | 11 = 3 bytes : FLAG_GROUP_ADDRESS_TYPE_THREEBYTES
* g | has several chars ? 1 bit, 1 = yes, 0 = no : FLAG_HAS_MULTIPLE_CHARS
* s | has a terminal ? 1 bit, 1 = yes, 0 = no : FLAG_IS_TERMINAL
- * | reserved 1 bit, 1 = yes, 0 = no
+ * | has shortcut targets ? 1 bit, 1 = yes, 0 = no : FLAG_HAS_SHORTCUT_TARGETS
* | has bigrams ? 1 bit, 1 = yes, 0 = no : FLAG_HAS_BIGRAMS
+ * | is shortcut only ? 1 bit, 1 = yes, 0 = no : FLAG_IS_SHORTCUT_ONLY
*
* c | IF FLAG_HAS_MULTIPLE_CHARS
* h | char, char, char, char n * (1 or 3 bytes) : use CharGroupInfo for i/o helpers
@@ -71,6 +72,8 @@ public class BinaryDictInputOutput {
* d
* dress
*
+ * | IF FLAG_IS_TERMINAL && FLAG_HAS_SHORTCUT_TARGETS
+ * | shortcut targets address list
* | IF FLAG_IS_TERMINAL && FLAG_HAS_BIGRAMS
* | bigrams address list
*
@@ -126,7 +129,9 @@ public class BinaryDictInputOutput {
private static final int FLAG_HAS_MULTIPLE_CHARS = 0x20;
private static final int FLAG_IS_TERMINAL = 0x10;
+ private static final int FLAG_HAS_SHORTCUT_TARGETS = 0x08;
private static final int FLAG_HAS_BIGRAMS = 0x04;
+ private static final int FLAG_IS_SHORTCUT_ONLY = 0x02;
private static final int FLAG_ATTRIBUTE_HAS_NEXT = 0x80;
private static final int FLAG_ATTRIBUTE_OFFSET_NEGATIVE = 0x40;
@@ -942,11 +947,13 @@ public class BinaryDictInputOutput {
source.seek(currentPosition);
}
nodeContents.add(
- new CharGroup(info.mCharacters, bigrams, info.mFrequency,
+ // TODO: read and pass the shortcut targets
+ new CharGroup(info.mCharacters, null, bigrams, info.mFrequency,
children));
} else {
+ // TODO: read and pass the shortcut targets
nodeContents.add(
- new CharGroup(info.mCharacters, bigrams, info.mFrequency));
+ new CharGroup(info.mCharacters, null, bigrams, info.mFrequency));
}
groupOffset = info.mEndAddress;
}
@@ -996,7 +1003,8 @@ public class BinaryDictInputOutput {
new FusionDictionary.DictionaryOptions());
if (null != dict) {
for (Word w : dict) {
- newDict.add(w.mWord, w.mFrequency, w.mBigrams);
+ // TODO: pass the shortcut targets
+ newDict.add(w.mWord, w.mFrequency, null, w.mBigrams);
}
}