diff options
author | 2013-08-26 01:33:04 -0700 | |
---|---|---|
committer | 2013-08-26 01:33:04 -0700 | |
commit | eee7c3d82fe9c0df3a2d9678425c507c6a21f86e (patch) | |
tree | 740abfc9fc2e1500df8ef77c0482cc38dd21f259 /java/src/com/android/inputmethod/latin/makedict/DictDecoder.java | |
parent | 370783a6163f877c71ede59fec1dd0a9f8dc3411 (diff) | |
parent | d21adb586506e292de471eb2e0dcea0c87019d0a (diff) | |
download | latinime-eee7c3d82fe9c0df3a2d9678425c507c6a21f86e.tar.gz latinime-eee7c3d82fe9c0df3a2d9678425c507c6a21f86e.tar.xz latinime-eee7c3d82fe9c0df3a2d9678425c507c6a21f86e.zip |
am d21adb58: Merge "[Refactor] Add DictDecoder.readUnigramsAndBigramsBinary."
* commit 'd21adb586506e292de471eb2e0dcea0c87019d0a':
[Refactor] Add DictDecoder.readUnigramsAndBigramsBinary.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/DictDecoder.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/DictDecoder.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java index d5fcacc09..11a3f0b3a 100644 --- a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java +++ b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java @@ -29,6 +29,8 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.ArrayList; +import java.util.TreeMap; /** * An interface of binary dictionary decoder. @@ -71,6 +73,21 @@ public interface DictDecoder { public int getTerminalPosition(final String word) throws IOException, UnsupportedFormatException; + /** + * Reads unigrams and bigrams from the binary file. + * Doesn't store a full memory representation of the dictionary. + * + * @param words the map to store the address as a key and the word as a value. + * @param frequencies the map to store the address as a key and the frequency as a value. + * @param bigrams the map to store the address as a key and the list of address as a value. + * @throws IOException if the file can't be read. + * @throws UnsupportedFormatException if the format of the file is not recognized. + */ + public void readUnigramsAndBigramsBinary(final TreeMap<Integer, String> words, + final TreeMap<Integer, Integer> frequencies, + final TreeMap<Integer, ArrayList<PendingAttribute>> bigrams) + throws IOException, UnsupportedFormatException; + // Flags for DictionaryBufferFactory. public static final int USE_READONLY_BYTEBUFFER = 0x01000000; public static final int USE_BYTEARRAY = 0x02000000; |