aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java11
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java6
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java12
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/DictDecoder.java (renamed from java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java)96
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java4
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java119
-rw-r--r--java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java6
-rw-r--r--java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java4
-rw-r--r--native/jni/Android.mk2
-rw-r--r--native/jni/com_android_inputmethod_latin_makedict_Ver3DictDecoder.cpp (renamed from native/jni/com_android_inputmethod_latin_makedict_BinaryDictDecoder.cpp)12
-rw-r--r--native/jni/com_android_inputmethod_latin_makedict_Ver3DictDecoder.h (renamed from native/jni/com_android_inputmethod_latin_makedict_BinaryDictDecoder.h)8
-rw-r--r--native/jni/jni_common.cpp6
-rw-r--r--native/jni/src/suggest/core/dictionary/probability_utils.h2
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java22
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java20
-rw-r--r--tests/src/com/android/inputmethod/latin/makedict/Ver3DictDecoderTests.java (renamed from tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderTests.java)25
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java6
-rw-r--r--tools/dicttool/NativeLib.mk2
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java6
-rw-r--r--tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java6
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java6
21 files changed, 203 insertions, 178 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
index 0f5fc71cb..8f6b848bb 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java
@@ -21,21 +21,16 @@ import android.content.SharedPreferences;
import android.content.res.AssetFileDescriptor;
import android.util.Log;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer;
-import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.nio.BufferUnderflowException;
-import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
@@ -233,9 +228,9 @@ final public class BinaryDictionaryGetter {
private static boolean hackCanUseDictionaryFile(final Locale locale, final File f) {
try {
// Read the version of the file
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(f);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(f);
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
final FileHeader header = dictDecoder.readHeader();
final String version = header.mDictionaryOptions.mAttributes.get(VERSION_KEY);
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
index d1974c8d4..995f061f3 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
@@ -40,7 +40,7 @@ import java.util.TreeMap;
*
* All the methods in this class are static.
*
- * TODO: Remove calls from classes except BinaryDictDecoder
+ * TODO: Remove calls from classes except Ver3DictDecoder
* TODO: Move this file to makedict/internal.
*/
public final class BinaryDictDecoderUtils {
@@ -649,13 +649,13 @@ public final class BinaryDictDecoderUtils {
* @return the created (or merged) dictionary.
*/
@UsedForTesting
- public static FusionDictionary readDictionaryBinary(final BinaryDictDecoder dictDecoder,
+ public static FusionDictionary readDictionaryBinary(final Ver3DictDecoder dictDecoder,
final FusionDictionary dict) throws FileNotFoundException, IOException,
UnsupportedFormatException {
// if the buffer has not been opened, open the buffer with bytebuffer.
if (dictDecoder.getDictBuffer() == null) dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
if (dictDecoder.getDictBuffer() == null) {
MakedictLog.e("Cannot open the buffer");
}
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
index 1abc779d0..0fa2cf428 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
@@ -148,7 +148,7 @@ public final class BinaryDictIOUtils {
* @throws IOException if the file can't be read.
* @throws UnsupportedFormatException if the format of the file is not recognized.
*/
- public static void readUnigramsAndBigramsBinary(final BinaryDictDecoder dictDecoder,
+ public static void readUnigramsAndBigramsBinary(final Ver3DictDecoder dictDecoder,
final Map<Integer, String> words, final Map<Integer, Integer> frequencies,
final Map<Integer, ArrayList<PendingAttribute>> bigrams) throws IOException,
UnsupportedFormatException {
@@ -169,7 +169,7 @@ public final class BinaryDictIOUtils {
* @throws UnsupportedFormatException if the format of the file is not recognized.
*/
@UsedForTesting
- public static int getTerminalPosition(final BinaryDictDecoder dictDecoder,
+ public static int getTerminalPosition(final Ver3DictDecoder dictDecoder,
final String word) throws IOException, UnsupportedFormatException {
final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
if (word == null) return FormatSpec.NOT_VALID_WORD;
@@ -508,7 +508,7 @@ public final class BinaryDictIOUtils {
}
/**
- * Find a word using the BinaryDictDecoder.
+ * Find a word using the Ver3DictDecoder.
*
* @param dictDecoder the dict reader
* @param word the word searched
@@ -517,7 +517,7 @@ public final class BinaryDictIOUtils {
* @throws UnsupportedFormatException
*/
@UsedForTesting
- public static CharGroupInfo findWordByBinaryDictReader(final BinaryDictDecoder dictDecoder,
+ public static CharGroupInfo findWordByBinaryDictReader(final Ver3DictDecoder dictDecoder,
final String word) throws IOException, UnsupportedFormatException {
int position = getTerminalPosition(dictDecoder, word);
final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
@@ -545,8 +545,8 @@ public final class BinaryDictIOUtils {
final File file, final long offset, final long length)
throws FileNotFoundException, IOException, UnsupportedFormatException {
final byte[] buffer = new byte[HEADER_READING_BUFFER_SIZE];
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
- dictDecoder.openDictBuffer(new BinaryDictDecoder.DictionaryBufferFactory() {
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
+ dictDecoder.openDictBuffer(new DictDecoder.DictionaryBufferFactory() {
@Override
public DictBuffer getDictionaryBuffer(File file)
throws FileNotFoundException, IOException {
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
index 2007b6284..a63d9d5ba 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
@@ -17,12 +17,9 @@
package com.android.inputmethod.latin.makedict;
import com.android.inputmethod.annotations.UsedForTesting;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.CharEncoding;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer;
import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
-import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
import com.android.inputmethod.latin.utils.ByteArrayDictBuffer;
-import com.android.inputmethod.latin.utils.JniUtils;
import java.io.File;
import java.io.FileInputStream;
@@ -31,18 +28,12 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
-import java.util.HashMap;
-// TODO: Rename this class to "Ver3DictDecoder" or something, and make an interface "DictDecoder".
-@UsedForTesting
-public class BinaryDictDecoder {
-
- static {
- JniUtils.loadNativeLibrary();
- }
-
- // TODO: implement something sensical instead of just a phony method
- private static native int doNothing();
+/**
+ * An interface of binary dictionary decoder.
+ */
+public interface DictDecoder {
+ public FileHeader readHeader() throws IOException, UnsupportedFormatException;
public interface DictionaryBufferFactory {
public DictBuffer getDictionaryBuffer(final File file)
@@ -133,81 +124,4 @@ public class BinaryDictDecoder {
return null;
}
}
-
- private final static class HeaderReader {
- protected static int readVersion(final DictBuffer dictBuffer)
- throws IOException, UnsupportedFormatException {
- return BinaryDictDecoderUtils.checkFormatVersion(dictBuffer);
- }
-
- protected static int readOptionFlags(final DictBuffer dictBuffer) {
- return dictBuffer.readUnsignedShort();
- }
-
- protected static int readHeaderSize(final DictBuffer dictBuffer) {
- return dictBuffer.readInt();
- }
-
- protected static HashMap<String, String> readAttributes(final DictBuffer dictBuffer,
- final int headerSize) {
- final HashMap<String, String> attributes = new HashMap<String, String>();
- while (dictBuffer.position() < headerSize) {
- // We can avoid an infinite loop here since dictBuffer.position() is always
- // increased by calling CharEncoding.readString.
- final String key = CharEncoding.readString(dictBuffer);
- final String value = CharEncoding.readString(dictBuffer);
- attributes.put(key, value);
- }
- dictBuffer.position(headerSize);
- return attributes;
- }
- }
-
- private final File mDictionaryBinaryFile;
- private DictBuffer mDictBuffer;
-
- public BinaryDictDecoder(final File file) {
- mDictionaryBinaryFile = file;
- mDictBuffer = null;
- }
-
- public void openDictBuffer(final DictionaryBufferFactory factory)
- throws FileNotFoundException, IOException {
- mDictBuffer = factory.getDictionaryBuffer(mDictionaryBinaryFile);
- }
-
- public DictBuffer getDictBuffer() {
- return mDictBuffer;
- }
-
- @UsedForTesting
- public DictBuffer openAndGetDictBuffer(
- final DictionaryBufferFactory factory)
- throws FileNotFoundException, IOException {
- openDictBuffer(factory);
- return getDictBuffer();
- }
-
- // TODO : Define public functions of decoders
- public FileHeader readHeader() throws IOException, UnsupportedFormatException {
- final int version = HeaderReader.readVersion(mDictBuffer);
- final int optionsFlags = HeaderReader.readOptionFlags(mDictBuffer);
-
- final int headerSize = HeaderReader.readHeaderSize(mDictBuffer);
-
- if (headerSize < 0) {
- throw new UnsupportedFormatException("header size can't be negative.");
- }
-
- final HashMap<String, String> attributes = HeaderReader.readAttributes(mDictBuffer,
- headerSize);
-
- final FileHeader header = new FileHeader(headerSize,
- new FusionDictionary.DictionaryOptions(attributes,
- 0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG),
- 0 != (optionsFlags & FormatSpec.FRENCH_LIGATURE_PROCESSING_FLAG)),
- new FormatOptions(version,
- 0 != (optionsFlags & FormatSpec.SUPPORTS_DYNAMIC_UPDATE)));
- return header;
- }
}
diff --git a/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java b/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java
index 6c1e75cbb..99deaa4f9 100644
--- a/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java
@@ -55,7 +55,7 @@ public final class DynamicBinaryDictIOUtils {
* @throws UnsupportedFormatException
*/
@UsedForTesting
- public static void deleteWord(final BinaryDictDecoder dictDecoder, final String word)
+ public static void deleteWord(final Ver3DictDecoder dictDecoder, final String word)
throws IOException, UnsupportedFormatException {
final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
dictBuffer.position(0);
@@ -253,7 +253,7 @@ public final class DynamicBinaryDictIOUtils {
// TODO: Support batch insertion.
// TODO: Remove @UsedForTesting once UserHistoryDictionary is implemented by BinaryDictionary.
@UsedForTesting
- public static void insertWord(final BinaryDictDecoder dictDecoder,
+ public static void insertWord(final Ver3DictDecoder dictDecoder,
final OutputStream destination, final String word, final int frequency,
final ArrayList<WeightedString> bigramStrings,
final ArrayList<WeightedString> shortcuts, final boolean isNotAWord,
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java
new file mode 100644
index 000000000..7a9323c2f
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.makedict;
+
+import com.android.inputmethod.annotations.UsedForTesting;
+import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.CharEncoding;
+import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer;
+import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
+import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
+import com.android.inputmethod.latin.utils.JniUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * An implementation of DictDecoder for version 3 binary dictionary.
+ */
+@UsedForTesting
+public class Ver3DictDecoder implements DictDecoder {
+
+ static {
+ JniUtils.loadNativeLibrary();
+ }
+
+ // TODO: implement something sensical instead of just a phony method
+ private static native int doNothing();
+
+ private final static class HeaderReader {
+ protected static int readVersion(final DictBuffer dictBuffer)
+ throws IOException, UnsupportedFormatException {
+ return BinaryDictDecoderUtils.checkFormatVersion(dictBuffer);
+ }
+
+ protected static int readOptionFlags(final DictBuffer dictBuffer) {
+ return dictBuffer.readUnsignedShort();
+ }
+
+ protected static int readHeaderSize(final DictBuffer dictBuffer) {
+ return dictBuffer.readInt();
+ }
+
+ protected static HashMap<String, String> readAttributes(final DictBuffer dictBuffer,
+ final int headerSize) {
+ final HashMap<String, String> attributes = new HashMap<String, String>();
+ while (dictBuffer.position() < headerSize) {
+ // We can avoid an infinite loop here since dictBuffer.position() is always
+ // increased by calling CharEncoding.readString.
+ final String key = CharEncoding.readString(dictBuffer);
+ final String value = CharEncoding.readString(dictBuffer);
+ attributes.put(key, value);
+ }
+ dictBuffer.position(headerSize);
+ return attributes;
+ }
+ }
+
+ private final File mDictionaryBinaryFile;
+ private DictBuffer mDictBuffer;
+
+ public Ver3DictDecoder(final File file) {
+ mDictionaryBinaryFile = file;
+ mDictBuffer = null;
+ }
+
+ public void openDictBuffer(final DictDecoder.DictionaryBufferFactory factory)
+ throws FileNotFoundException, IOException {
+ mDictBuffer = factory.getDictionaryBuffer(mDictionaryBinaryFile);
+ }
+
+ public DictBuffer getDictBuffer() {
+ return mDictBuffer;
+ }
+
+ @UsedForTesting
+ public DictBuffer openAndGetDictBuffer(final DictDecoder.DictionaryBufferFactory factory)
+ throws FileNotFoundException, IOException {
+ openDictBuffer(factory);
+ return getDictBuffer();
+ }
+
+ @Override
+ public FileHeader readHeader() throws IOException, UnsupportedFormatException {
+ final int version = HeaderReader.readVersion(mDictBuffer);
+ final int optionsFlags = HeaderReader.readOptionFlags(mDictBuffer);
+
+ final int headerSize = HeaderReader.readHeaderSize(mDictBuffer);
+
+ if (headerSize < 0) {
+ throw new UnsupportedFormatException("header size can't be negative.");
+ }
+
+ final HashMap<String, String> attributes = HeaderReader.readAttributes(mDictBuffer,
+ headerSize);
+
+ final FileHeader header = new FileHeader(headerSize,
+ new FusionDictionary.DictionaryOptions(attributes,
+ 0 != (optionsFlags & FormatSpec.GERMAN_UMLAUT_PROCESSING_FLAG),
+ 0 != (optionsFlags & FormatSpec.FRENCH_LIGATURE_PROCESSING_FLAG)),
+ new FormatOptions(version,
+ 0 != (optionsFlags & FormatSpec.SUPPORTS_DYNAMIC_UPDATE)));
+ return header;
+ }
+}
diff --git a/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java b/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java
index 8160501a9..b565b2f9f 100644
--- a/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java
+++ b/java/src/com/android/inputmethod/latin/personalization/DynamicPredictionDictionaryBase.java
@@ -28,8 +28,8 @@ import com.android.inputmethod.latin.ExpandableDictionary;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.WordComposer;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import com.android.inputmethod.latin.settings.Settings;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils;
@@ -241,10 +241,10 @@ public abstract class DynamicPredictionDictionaryBase extends ExpandableDictiona
};
// Load the dictionary from binary file
- final BinaryDictDecoder reader = new BinaryDictDecoder(
+ final Ver3DictDecoder reader = new Ver3DictDecoder(
new File(getContext().getFilesDir(), fileName));
try {
- reader.openDictBuffer(new BinaryDictDecoder.DictionaryBufferFromByteArrayFactory());
+ reader.openDictBuffer(new Ver3DictDecoder.DictionaryBufferFromByteArrayFactory());
UserHistoryDictIOUtils.readDictionaryBinary(reader, listener);
} catch (FileNotFoundException e) {
// This is an expected condition: we don't have a user history dictionary for this
diff --git a/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java b/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java
index dd7f534dc..768d68cb3 100644
--- a/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtils.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.latin.utils;
import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
import com.android.inputmethod.latin.makedict.BinaryDictEncoder;
import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
@@ -27,6 +26,7 @@ import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
import com.android.inputmethod.latin.makedict.PendingAttribute;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import com.android.inputmethod.latin.personalization.UserHistoryDictionaryBigramList;
import java.io.IOException;
@@ -118,7 +118,7 @@ public final class UserHistoryDictIOUtils {
/**
* Reads dictionary from file.
*/
- public static void readDictionaryBinary(final BinaryDictDecoder dictDecoder,
+ public static void readDictionaryBinary(final Ver3DictDecoder dictDecoder,
final OnAddWordListener dict) {
final Map<Integer, String> unigrams = CollectionUtils.newTreeMap();
final Map<Integer, Integer> frequencies = CollectionUtils.newTreeMap();
diff --git a/native/jni/Android.mk b/native/jni/Android.mk
index 9e7407abd..a51fe3c03 100644
--- a/native/jni/Android.mk
+++ b/native/jni/Android.mk
@@ -43,7 +43,7 @@ LATIN_IME_JNI_SRC_FILES := \
com_android_inputmethod_keyboard_ProximityInfo.cpp \
com_android_inputmethod_latin_BinaryDictionary.cpp \
com_android_inputmethod_latin_DicTraverseSession.cpp \
- com_android_inputmethod_latin_makedict_BinaryDictDecoder.cpp \
+ com_android_inputmethod_latin_makedict_Ver3DictDecoder.cpp \
jni_common.cpp
LATIN_IME_CORE_SRC_FILES := \
diff --git a/native/jni/com_android_inputmethod_latin_makedict_BinaryDictDecoder.cpp b/native/jni/com_android_inputmethod_latin_makedict_Ver3DictDecoder.cpp
index 457b226b6..15088b65a 100644
--- a/native/jni/com_android_inputmethod_latin_makedict_BinaryDictDecoder.cpp
+++ b/native/jni/com_android_inputmethod_latin_makedict_Ver3DictDecoder.cpp
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-#define LOG_TAG "LatinIME: jni: BinaryDictDecoder"
+#define LOG_TAG "LatinIME: jni: Ver3DictDecoder"
-#include "com_android_inputmethod_latin_makedict_BinaryDictDecoder.h"
+#include "com_android_inputmethod_latin_makedict_Ver3DictDecoder.h"
#include "defines.h"
#include "jni.h"
#include "jni_common.h"
namespace latinime {
-static int latinime_BinaryDictDecoder_doNothing(JNIEnv *env, jclass clazz) {
+static int latinime_Ver3DictDecoder_doNothing(JNIEnv *env, jclass clazz) {
// This is a phony method for test - it does nothing. It just returns some value
// unlikely to be in memory by chance for testing purposes.
// TODO: remove this method.
@@ -35,13 +35,13 @@ static const JNINativeMethod sMethods[] = {
// TODO: remove this entry when we have one useful method in here
const_cast<char *>("doNothing"),
const_cast<char *>("()I"),
- reinterpret_cast<void *>(latinime_BinaryDictDecoder_doNothing)
+ reinterpret_cast<void *>(latinime_Ver3DictDecoder_doNothing)
},
};
-int register_BinaryDictDecoder(JNIEnv *env) {
+int register_Ver3DictDecoder(JNIEnv *env) {
const char *const kClassPathName =
- "com/android/inputmethod/latin/makedict/BinaryDictDecoder";
+ "com/android/inputmethod/latin/makedict/Ver3DictDecoder";
return registerNativeMethods(env, kClassPathName, sMethods, NELEMS(sMethods));
}
} // namespace latinime
diff --git a/native/jni/com_android_inputmethod_latin_makedict_BinaryDictDecoder.h b/native/jni/com_android_inputmethod_latin_makedict_Ver3DictDecoder.h
index 7f3cb67e6..07e80f1d8 100644
--- a/native/jni/com_android_inputmethod_latin_makedict_BinaryDictDecoder.h
+++ b/native/jni/com_android_inputmethod_latin_makedict_Ver3DictDecoder.h
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#ifndef _COM_ANDROID_INPUTMETHOD_LATIN_MAKEDICT_BINARYDICTDECODER_H
-#define _COM_ANDROID_INPUTMETHOD_LATIN_MAKEDICT_BINARYDICTDECODER_H
+#ifndef _COM_ANDROID_INPUTMETHOD_LATIN_MAKEDICT_VER3DICTDECODER_H
+#define _COM_ANDROID_INPUTMETHOD_LATIN_MAKEDICT_VER3DICTDECODER_H
#include "jni.h"
namespace latinime {
-int register_BinaryDictDecoder(JNIEnv *env);
+int register_Ver3DictDecoder(JNIEnv *env);
} // namespace latinime
-#endif // _COM_ANDROID_INPUTMETHOD_LATIN_MAKEDICT_BINARYDICTDECODER_H
+#endif // _COM_ANDROID_INPUTMETHOD_LATIN_MAKEDICT_VER3DICTDECODER_H
diff --git a/native/jni/jni_common.cpp b/native/jni/jni_common.cpp
index d44be6705..3a8f4362d 100644
--- a/native/jni/jni_common.cpp
+++ b/native/jni/jni_common.cpp
@@ -23,7 +23,7 @@
#include "com_android_inputmethod_latin_BinaryDictionary.h"
#include "com_android_inputmethod_latin_DicTraverseSession.h"
#endif
-#include "com_android_inputmethod_latin_makedict_BinaryDictDecoder.h"
+#include "com_android_inputmethod_latin_makedict_Ver3DictDecoder.h"
#include "defines.h"
/*
@@ -55,8 +55,8 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return -1;
}
#endif
- if (!latinime::register_BinaryDictDecoder(env)) {
- AKLOGE("ERROR: BinaryDictDecoder native registration failed");
+ if (!latinime::register_Ver3DictDecoder(env)) {
+ AKLOGE("ERROR: Ver3DictDecoder native registration failed");
return -1;
}
/* success -- return valid version number */
diff --git a/native/jni/src/suggest/core/dictionary/probability_utils.h b/native/jni/src/suggest/core/dictionary/probability_utils.h
index 219213574..21fe355b8 100644
--- a/native/jni/src/suggest/core/dictionary/probability_utils.h
+++ b/native/jni/src/suggest/core/dictionary/probability_utils.h
@@ -41,7 +41,7 @@ class ProbabilityUtils {
// the unigram probability to be the median value of the 17th step from the top. A value of
// 0 for the bigram probability represents the middle of the 16th step from the top,
// while a value of 15 represents the middle of the top step.
- // See makedict.BinaryDictDecoder for details.
+ // See makedict.BinaryDictEncoder#makeBigramFlags for details.
const float stepSize = static_cast<float>(MAX_PROBABILITY - unigramProbability)
/ (1.5f + MAX_BIGRAM_ENCODED_PROBABILITY);
return unigramProbability
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
index 028e089f8..f3ca2b147 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
@@ -120,14 +120,14 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
/**
* Makes new DictBuffer according to BUFFER_TYPE.
*/
- private void getDictBuffer(final BinaryDictDecoder dictDecoder, final int bufferType)
+ private void getDictBuffer(final Ver3DictDecoder dictDecoder, final int bufferType)
throws FileNotFoundException, IOException {
if (bufferType == USE_BYTE_BUFFER) {
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
} else if (bufferType == USE_BYTE_ARRAY) {
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromByteArrayFactory());
+ new Ver3DictDecoder.DictionaryBufferFromByteArrayFactory());
}
}
@@ -271,7 +271,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
final SparseArray<List<Integer>> bigrams, final Map<String, List<String>> shortcutMap,
final int bufferType) {
long now, diff = -1;
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
FusionDictionary dict = null;
try {
@@ -409,7 +409,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
final Map<Integer, Integer> resultFreqs = CollectionUtils.newTreeMap();
long now = -1, diff = -1;
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
try {
getDictBuffer(dictDecoder, bufferType);
assertNotNull("Can't get buffer.", dictDecoder.getDictBuffer());
@@ -499,7 +499,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
}
// Tests for getTerminalPosition
- private String getWordFromBinary(final BinaryDictDecoder dictDecoder, final int address) {
+ private String getWordFromBinary(final Ver3DictDecoder dictDecoder, final int address) {
final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
if (dictBuffer.position() != 0) dictBuffer.position(0);
@@ -516,7 +516,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
address - fileHeader.mHeaderSize, fileHeader.mFormatOptions).mWord;
}
- private long runGetTerminalPosition(final BinaryDictDecoder dictDecoder, final String word,
+ private long runGetTerminalPosition(final Ver3DictDecoder dictDecoder, final String word,
int index, boolean contained) {
final int expectedFrequency = (UNIGRAM_FREQ + index) % 255;
long diff = -1;
@@ -552,10 +552,10 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
addUnigrams(sWords.size(), dict, sWords, null /* shortcutMap */);
timeWritingDictToFile(file, dict, VERSION3_WITH_DYNAMIC_UPDATE);
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
try {
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromByteArrayFactory());
+ new Ver3DictDecoder.DictionaryBufferFromByteArrayFactory());
} catch (IOException e) {
// ignore
Log.e(TAG, "IOException while opening the buffer", e);
@@ -613,10 +613,10 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
addUnigrams(sWords.size(), dict, sWords, null /* shortcutMap */);
timeWritingDictToFile(file, dict, VERSION3_WITH_DYNAMIC_UPDATE);
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
try {
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromByteArrayFactory());
+ new Ver3DictDecoder.DictionaryBufferFromByteArrayFactory());
} catch (IOException e) {
// ignore
Log.e(TAG, "IOException while opening the buffer", e);
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java
index b6e439561..74c20a38c 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java
@@ -22,7 +22,7 @@ import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder.
+import com.android.inputmethod.latin.makedict.DictDecoder.
DictionaryBufferFromWritableByteBufferFactory;
import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
@@ -128,7 +128,7 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
}
}
- private static void printBinaryFile(final BinaryDictDecoder dictDecoder)
+ private static void printBinaryFile(final Ver3DictDecoder dictDecoder)
throws IOException, UnsupportedFormatException {
final FileHeader fileHeader = dictDecoder.readHeader();
final DictBuffer buffer = dictDecoder.getDictBuffer();
@@ -139,12 +139,12 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
private int getWordPosition(final File file, final String word) {
int position = FormatSpec.NOT_VALID_WORD;
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
position = BinaryDictIOUtils.getTerminalPosition(dictDecoder, word);
} catch (IOException e) {
} catch (UnsupportedFormatException e) {
@@ -161,11 +161,11 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
}
private CharGroupInfo findWordFromFile(final File file, final String word) {
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
CharGroupInfo info = null;
try {
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
info = BinaryDictIOUtils.findWordByBinaryDictReader(dictDecoder, word);
} catch (IOException e) {
} catch (UnsupportedFormatException e) {
@@ -177,7 +177,7 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
private long insertAndCheckWord(final File file, final String word, final int frequency,
final boolean exist, final ArrayList<WeightedString> bigrams,
final ArrayList<WeightedString> shortcuts) {
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
BufferedOutputStream outStream = null;
long amountOfTime = -1;
try {
@@ -211,7 +211,7 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
}
private void deleteWord(final File file, final String word) {
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
try {
dictDecoder.openDictBuffer(new DictionaryBufferFromWritableByteBufferFactory());
DynamicBinaryDictIOUtils.deleteWord(dictDecoder, word);
@@ -221,10 +221,10 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
}
private void checkReverseLookup(final File file, final String word, final int position) {
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
try {
final DictBuffer dictBuffer = dictDecoder.openAndGetDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
final FileHeader fileHeader = dictDecoder.readHeader();
assertEquals(word,
BinaryDictDecoderUtils.getWordAtAddress(dictDecoder.getDictBuffer(),
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/Ver3DictDecoderTests.java
index 03742c4c1..20e8b4fda 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/Ver3DictDecoderTests.java
@@ -17,12 +17,11 @@
package com.android.inputmethod.latin.makedict;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils.DictBuffer;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder.DictionaryBufferFactory;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder.
- DictionaryBufferFromByteArrayFactory;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder.
+import com.android.inputmethod.latin.makedict.DictDecoder.DictionaryBufferFactory;
+import com.android.inputmethod.latin.makedict.DictDecoder.DictionaryBufferFromByteArrayFactory;
+import com.android.inputmethod.latin.makedict.DictDecoder.
DictionaryBufferFromReadOnlyByteBufferFactory;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder.
+import com.android.inputmethod.latin.makedict.DictDecoder.
DictionaryBufferFromWritableByteBufferFactory;
import android.test.AndroidTestCase;
@@ -33,10 +32,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
/**
- * Unit tests for BinaryDictDecoder
+ * Unit tests for Ver3DictDecoder
*/
-public class BinaryDictDecoderTests extends AndroidTestCase {
- private static final String TAG = BinaryDictDecoderTests.class.getSimpleName();
+public class Ver3DictDecoderTests extends AndroidTestCase {
+ private static final String TAG = Ver3DictDecoderTests.class.getSimpleName();
private final byte[] data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
@@ -60,8 +59,7 @@ public class BinaryDictDecoderTests extends AndroidTestCase {
}
@SuppressWarnings("null")
- public void runTestOpenBuffer(final String testName,
- final DictionaryBufferFactory factory) {
+ public void runTestOpenBuffer(final String testName, final DictionaryBufferFactory factory) {
File testFile = null;
try {
testFile = File.createTempFile(testName, ".tmp", getContext().getCacheDir());
@@ -70,7 +68,7 @@ public class BinaryDictDecoderTests extends AndroidTestCase {
}
assertNotNull(testFile);
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(testFile);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(testFile);
try {
dictDecoder.openDictBuffer(factory);
} catch (Exception e) {
@@ -104,8 +102,7 @@ public class BinaryDictDecoderTests extends AndroidTestCase {
}
@SuppressWarnings("null")
- public void runTestGetBuffer(final String testName,
- final DictionaryBufferFactory factory) {
+ public void runTestGetBuffer(final String testName, final DictionaryBufferFactory factory) {
File testFile = null;
try {
testFile = File.createTempFile(testName, ".tmp", getContext().getCacheDir());
@@ -113,7 +110,7 @@ public class BinaryDictDecoderTests extends AndroidTestCase {
Log.e(TAG, "IOException while the creating temporary file", e);
}
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(testFile);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(testFile);
// the default return value of getBuffer() must be null.
assertNull("the default return value of getBuffer() is not null",
diff --git a/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java
index 83d9c2122..eca12c0d8 100644
--- a/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/UserHistoryDictIOUtilsTests.java
@@ -21,10 +21,10 @@ import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import com.android.inputmethod.latin.personalization.UserHistoryDictionaryBigramList;
import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.BigramDictionaryInterface;
import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.OnAddWordListener;
@@ -147,10 +147,10 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase
}
private void readDictFromFile(final File file, final OnAddWordListener listener) {
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
try {
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromByteArrayFactory());
+ new Ver3DictDecoder.DictionaryBufferFromByteArrayFactory());
} catch (FileNotFoundException e) {
Log.e(TAG, "file not found", e);
} catch (IOException e) {
diff --git a/tools/dicttool/NativeLib.mk b/tools/dicttool/NativeLib.mk
index 84e54a931..a3d3c0295 100644
--- a/tools/dicttool/NativeLib.mk
+++ b/tools/dicttool/NativeLib.mk
@@ -34,7 +34,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(LATINIME_NATIVE_SRC_DIR)
# Used in jni_common.cpp to avoid registering useless methods.
LATIN_IME_JNI_SRC_FILES := \
- com_android_inputmethod_latin_makedict_BinaryDictDecoder.cpp \
+ com_android_inputmethod_latin_makedict_Ver3DictDecoder.cpp \
jni_common.cpp
LATIN_IME_CORE_SRC_FILES :=
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
index 39ba69b1f..d8fcbeeaf 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtils.java
@@ -17,9 +17,9 @@
package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import org.xml.sax.SAXException;
@@ -184,9 +184,9 @@ public final class BinaryDictOffdeviceUtils {
crash(filename, new RuntimeException(
filename + " does not seem to be a dictionary file"));
} else {
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(decodedSpec.mFile);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(decodedSpec.mFile);
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromByteArrayFactory());
+ new Ver3DictDecoder.DictionaryBufferFromByteArrayFactory());
if (report) {
System.out.println("Format : Binary dictionary format");
System.out.println("Packaging : " + decodedSpec.describeChain());
diff --git a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
index f87e9722c..a0fcaabd0 100644
--- a/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
+++ b/tools/dicttool/src/com/android/inputmethod/latin/dicttool/DictionaryMaker.java
@@ -18,11 +18,11 @@ package com.android.inputmethod.latin.dicttool;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
import com.android.inputmethod.latin.makedict.BinaryDictEncoder;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.MakedictLog;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import java.io.BufferedWriter;
import java.io.File;
@@ -266,9 +266,9 @@ public class DictionaryMaker {
private static FusionDictionary readBinaryFile(final String binaryFilename)
throws FileNotFoundException, IOException, UnsupportedFormatException {
final File file = new File(binaryFilename);
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(file);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
return BinaryDictDecoderUtils.readDictionaryBinary(dictDecoder, null);
}
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
index b960b035d..451b145e9 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
@@ -16,7 +16,6 @@
package com.android.inputmethod.latin.dicttool;
-import com.android.inputmethod.latin.makedict.BinaryDictDecoder;
import com.android.inputmethod.latin.makedict.BinaryDictDecoderUtils;
import com.android.inputmethod.latin.makedict.BinaryDictEncoder;
import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
@@ -24,6 +23,7 @@ import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions;
import com.android.inputmethod.latin.makedict.FusionDictionary.PtNodeArray;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
+import com.android.inputmethod.latin.makedict.Ver3DictDecoder;
import junit.framework.TestCase;
@@ -67,9 +67,9 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
assertEquals("Wrong decode spec", BinaryDictOffdeviceUtils.COMPRESSION, step);
}
assertEquals("Wrong decode spec", 3, decodeSpec.mDecoderSpec.size());
- final BinaryDictDecoder dictDecoder = new BinaryDictDecoder(decodeSpec.mFile);
+ final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(decodeSpec.mFile);
dictDecoder.openDictBuffer(
- new BinaryDictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
+ new Ver3DictDecoder.DictionaryBufferFromReadOnlyByteBufferFactory());
final FusionDictionary resultDict = BinaryDictDecoderUtils.readDictionaryBinary(dictDecoder,
null /* dict : an optional dictionary to add words to, or null */);
assertEquals("Dictionary can't be read back correctly",