diff options
author | 2013-08-26 08:28:44 +0000 | |
---|---|---|
committer | 2013-08-26 08:28:44 +0000 | |
commit | d21adb586506e292de471eb2e0dcea0c87019d0a (patch) | |
tree | 6922c1f3f0f278eeee375cd572c234f4e8e4e331 /java/src/com/android/inputmethod/latin/makedict/DictDecoder.java | |
parent | 4e7825cb583503504f931265ef4405f6c12e9e85 (diff) | |
parent | 752a33640c0160a2f836f716bf60e4991c07da1c (diff) | |
download | latinime-d21adb586506e292de471eb2e0dcea0c87019d0a.tar.gz latinime-d21adb586506e292de471eb2e0dcea0c87019d0a.tar.xz latinime-d21adb586506e292de471eb2e0dcea0c87019d0a.zip |
Merge "[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; |