From 72b1c9394105b6fbc0d8c6ff00f3574ee37a9aaa Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 31 Aug 2012 15:24:39 +0900 Subject: Reinstate the shortcut-only attribute Also add the blacklist attribute Bug: 7005742 Bug: 2704000 Change-Id: Icbe60bdf25bfb098d9e3f20870be30d6aef07c9d --- .../src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java') diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index cdf5247de..8a509be48 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -172,12 +172,12 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { // considering performance regression. protected void addWord(final String word, final String shortcutTarget, final int frequency) { if (shortcutTarget == null) { - mFusionDictionary.add(word, frequency, null); + mFusionDictionary.add(word, frequency, null, false /* isNotAWord */); } else { // TODO: Do this in the subclass, with this class taking an arraylist. final ArrayList shortcutTargets = CollectionUtils.newArrayList(); shortcutTargets.add(new WeightedString(shortcutTarget, frequency)); - mFusionDictionary.add(word, frequency, shortcutTargets); + mFusionDictionary.add(word, frequency, shortcutTargets, false /* isNotAWord */); } } -- cgit v1.2.3-83-g751a From 83dfe0fd8c7e2bce2717930dbf8732f5414ee39d Mon Sep 17 00:00:00 2001 From: Yuichiro Hanada Date: Wed, 5 Sep 2012 12:37:56 +0900 Subject: Add FormatOptions. Change-Id: Ibad05a5f9143de1156b2c897593ec89b0a0b07e7 --- .../latin/ExpandableBinaryDictionary.java | 6 +- .../inputmethod/latin/UserHistoryDictIOUtils.java | 5 +- .../latin/makedict/BinaryDictInputOutput.java | 72 +++++++++++++++------- .../inputmethod/latin/BinaryDictIOTests.java | 5 +- .../latin/UserHistoryDictIOUtilsTests.java | 5 +- .../latin/dicttool/DictionaryMaker.java | 4 +- 6 files changed, 69 insertions(+), 28 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java') diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 8a509be48..def978e4b 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -89,6 +89,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { /** Controls access to the local binary dictionary for this instance. */ private final DictionaryController mLocalDictionaryController = new DictionaryController(); + private static final int BINARY_DICT_VERSION = 1; + private static final BinaryDictInputOutput.FormatOptions FORMAT_OPTIONS = + new BinaryDictInputOutput.FormatOptions(BINARY_DICT_VERSION); + /** * Abstract method for loading the unigrams and bigrams of a given dictionary in a background * thread. @@ -310,7 +314,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { FileOutputStream out = null; try { out = new FileOutputStream(tempFile); - BinaryDictInputOutput.writeDictionaryBinary(out, mFusionDictionary, 1); + BinaryDictInputOutput.writeDictionaryBinary(out, mFusionDictionary, FORMAT_OPTIONS); out.flush(); out.close(); tempFile.renameTo(file); diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java index 942c82837..81d61e957 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import android.util.Log; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FormatOptions; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; @@ -97,12 +98,12 @@ public class UserHistoryDictIOUtils { */ public static void writeDictionaryBinary(final OutputStream destination, final BigramDictionaryInterface dict, final UserHistoryDictionaryBigramList bigrams, - final int version) { + final FormatOptions formatOptions) { final FusionDictionary fusionDict = constructFusionDictionary(dict, bigrams); try { - BinaryDictInputOutput.writeDictionaryBinary(destination, fusionDict, version); + BinaryDictInputOutput.writeDictionaryBinary(destination, fusionDict, formatOptions); } catch (IOException e) { Log.e(TAG, "IO exception while writing file: " + e); } catch (UnsupportedFormatException e) { diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java index abc39d923..7de5cf340 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java @@ -241,6 +241,31 @@ public class BinaryDictInputOutput { } } + /** + * Options about file format. + */ + public static class FormatOptions { + public final int mVersion; + public FormatOptions(final int version) { + mVersion = version; + } + } + + /** + * Class representing file header. + */ + private static final class FileHeader { + public final int mHeaderSize; + public final DictionaryOptions mDictionaryOptions; + public final FormatOptions mFormatOptions; + public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, + final FormatOptions formatOptions) { + mHeaderSize = headerSize; + mDictionaryOptions = dictionaryOptions; + mFormatOptions = formatOptions; + } + } + /** * A class grouping utility function for our specific character encoding. */ @@ -1051,10 +1076,10 @@ public class BinaryDictInputOutput { * * @param destination the stream to write the binary data to. * @param dict the dictionary to write. - * @param version the version of the format to write, currently either 1 or 2. + * @param formatOptions the options of file format. */ public static void writeDictionaryBinary(final OutputStream destination, - final FusionDictionary dict, final int version) + final FusionDictionary dict, final FormatOptions formatOptions) throws IOException, UnsupportedFormatException { // Addresses are limited to 3 bytes, but since addresses can be relative to each node, the @@ -1063,6 +1088,7 @@ public class BinaryDictInputOutput { // does not have a size limit, each node must still be within 16MB of all its children and // parents. As long as this is ensured, the dictionary file may grow to any size. + final int version = formatOptions.mVersion; if (version < MINIMUM_SUPPORTED_VERSION || version > MAXIMUM_SUPPORTED_VERSION) { throw new UnsupportedFormatException("Requested file format version " + version + ", but this implementation only supports versions " @@ -1471,12 +1497,11 @@ public class BinaryDictInputOutput { final Map> bigrams) throws IOException, UnsupportedFormatException { // Read header - final int version = checkFormatVersion(buffer); - final int optionsFlags = buffer.readUnsignedShort(); - final HashMap options = new HashMap(); - final int headerSize = readHeader(buffer, options, version); + FormatOptions formatOptions = null; + DictionaryOptions dictionaryOptions = null; + final FileHeader header = readHeader(buffer); - readUnigramsAndBigramsBinaryInner(buffer, headerSize, words, frequencies, bigrams); + readUnigramsAndBigramsBinaryInner(buffer, header.mHeaderSize, words, frequencies, bigrams); } /** @@ -1510,25 +1535,35 @@ public class BinaryDictInputOutput { /** * Reads a header from a buffer. + * @param buffer the buffer to read. * @throws IOException * @throws UnsupportedFormatException */ - private static int readHeader(final FusionDictionaryBufferInterface buffer, - final HashMap options, final int version) + private static FileHeader readHeader(final FusionDictionaryBufferInterface buffer) throws IOException, UnsupportedFormatException { + final int version = checkFormatVersion(buffer); + final int optionsFlags = buffer.readUnsignedShort(); + + final HashMap attributes = new HashMap(); final int headerSize; if (version < FIRST_VERSION_WITH_HEADER_SIZE) { headerSize = buffer.position(); } else { headerSize = buffer.readInt(); - populateOptions(buffer, headerSize, options); + populateOptions(buffer, headerSize, attributes); buffer.position(headerSize); } if (headerSize < 0) { throw new UnsupportedFormatException("header size can't be negative."); } - return headerSize; + + final FileHeader header = new FileHeader(headerSize, + new FusionDictionary.DictionaryOptions(attributes, + 0 != (optionsFlags & GERMAN_UMLAUT_PROCESSING_FLAG), + 0 != (optionsFlags & FRENCH_LIGATURE_PROCESSING_FLAG)), + new FormatOptions(version)); + return header; } /** @@ -1569,21 +1604,14 @@ public class BinaryDictInputOutput { wordCache.clear(); // Read header - final int version = checkFormatVersion(buffer); - final int optionsFlags = buffer.readUnsignedShort(); - - final HashMap options = new HashMap(); - final int headerSize = readHeader(buffer, options, version); + final FileHeader header = readHeader(buffer); Map reverseNodeMapping = new TreeMap(); Map reverseGroupMapping = new TreeMap(); - final Node root = readNode( - buffer, headerSize, reverseNodeMapping, reverseGroupMapping); + final Node root = readNode(buffer, header.mHeaderSize, reverseNodeMapping, + reverseGroupMapping); - FusionDictionary newDict = new FusionDictionary(root, - new FusionDictionary.DictionaryOptions(options, - 0 != (optionsFlags & GERMAN_UMLAUT_PROCESSING_FLAG), - 0 != (optionsFlags & FRENCH_LIGATURE_PROCESSING_FLAG))); + FusionDictionary newDict = new FusionDictionary(root, header.mDictionaryOptions); if (null != dict) { for (final Word w : dict) { if (w.mIsBlacklistEntry) { diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictIOTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictIOTests.java index 9b7f4a7f9..c6ab52c48 100644 --- a/tests/src/com/android/inputmethod/latin/BinaryDictIOTests.java +++ b/tests/src/com/android/inputmethod/latin/BinaryDictIOTests.java @@ -52,6 +52,9 @@ public class BinaryDictIOTests extends AndroidTestCase { private static final int BIGRAM_FREQ = 50; private static final int TOLERANCE_OF_BIGRAM_FREQ = 5; + private static final BinaryDictInputOutput.FormatOptions VERSION2 = + new BinaryDictInputOutput.FormatOptions(2); + private static final String[] CHARACTERS = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", @@ -112,7 +115,7 @@ public class BinaryDictIOTests extends AndroidTestCase { final FileOutputStream out = new FileOutputStream(file); now = System.currentTimeMillis(); - BinaryDictInputOutput.writeDictionaryBinary(out, dict, 2); + BinaryDictInputOutput.writeDictionaryBinary(out, dict, VERSION2); diff = System.currentTimeMillis() - now; out.flush(); diff --git a/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java index 8f0551b4c..5fa740f6e 100644 --- a/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java @@ -18,6 +18,7 @@ package com.android.inputmethod.latin; import com.android.inputmethod.latin.UserHistoryDictIOUtils.BigramDictionaryInterface; import com.android.inputmethod.latin.UserHistoryDictIOUtils.OnAddWordListener; +import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup; @@ -44,6 +45,8 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase private static final int UNIGRAM_FREQUENCY = 50; private static final int BIGRAM_FREQUENCY = 100; private static final ArrayList NOT_HAVE_BIGRAM = new ArrayList(); + private static final BinaryDictInputOutput.FormatOptions FORMAT_OPTIONS = + new BinaryDictInputOutput.FormatOptions(2); /** * Return same frequency for all words and bigrams @@ -132,7 +135,7 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase final UserHistoryDictionaryBigramList bigramList) { try { final FileOutputStream out = new FileOutputStream(file); - UserHistoryDictIOUtils.writeDictionaryBinary(out, this, bigramList, 2); + UserHistoryDictIOUtils.writeDictionaryBinary(out, this, bigramList, FORMAT_OPTIONS); out.flush(); out.close(); } catch (IOException e) { diff --git a/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java index fbfc1dabb..f72385259 100644 --- a/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java +++ b/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java @@ -317,8 +317,10 @@ public class DictionaryMaker { final FusionDictionary dict, final int version) throws FileNotFoundException, IOException, UnsupportedFormatException { final File outputFile = new File(outputFilename); + final BinaryDictInputOutput.FormatOptions formatOptions = + new BinaryDictInputOutput.FormatOptions(version); BinaryDictInputOutput.writeDictionaryBinary(new FileOutputStream(outputFilename), dict, - version); + formatOptions); } /** -- cgit v1.2.3-83-g751a From 1a347723c5ad4a71076df67f3af3b702db205719 Mon Sep 17 00:00:00 2001 From: Yuichiro Hanada Date: Wed, 12 Sep 2012 18:53:33 +0900 Subject: Move FormatOptions and FileHeader to FormatSpec. Change-Id: I232e35598635113bf2c81825669c744aadc79efe --- .../latin/ExpandableBinaryDictionary.java | 5 +-- .../inputmethod/latin/UserHistoryDictIOUtils.java | 2 +- .../latin/makedict/BinaryDictInputOutput.java | 36 ++-------------------- .../inputmethod/latin/makedict/FormatSpec.java | 35 +++++++++++++++++++++ .../latin/UserHistoryDictIOUtilsTests.java | 4 +-- .../latin/makedict/BinaryDictIOTests.java | 4 +-- .../latin/dicttool/DictionaryMaker.java | 4 +-- 7 files changed, 47 insertions(+), 43 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java') diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index def978e4b..b93c17f11 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -21,6 +21,7 @@ import android.util.Log; import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString; @@ -90,8 +91,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { private final DictionaryController mLocalDictionaryController = new DictionaryController(); private static final int BINARY_DICT_VERSION = 1; - private static final BinaryDictInputOutput.FormatOptions FORMAT_OPTIONS = - new BinaryDictInputOutput.FormatOptions(BINARY_DICT_VERSION); + private static final FormatSpec.FormatOptions FORMAT_OPTIONS = + new FormatSpec.FormatOptions(BINARY_DICT_VERSION); /** * Abstract method for loading the unigrams and bigrams of a given dictionary in a background diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java index 1f5f1f7e6..550e4e58b 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictIOUtils.java @@ -19,8 +19,8 @@ package com.android.inputmethod.latin; import android.util.Log; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; -import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FormatOptions; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface; +import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; import com.android.inputmethod.latin.makedict.PendingAttribute; diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java index d268265c3..ef10f7270 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java @@ -16,6 +16,8 @@ package com.android.inputmethod.latin.makedict; +import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; +import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup; import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; @@ -107,40 +109,6 @@ public class BinaryDictInputOutput { } } - /** - * Options about file format. - */ - public static class FormatOptions { - public final int mVersion; - public final boolean mHasParentAddress; - public FormatOptions(final int version) { - this(version, false); - } - public FormatOptions(final int version, final boolean hasParentAddress) { - mVersion = version; - if (version < FormatSpec.FIRST_VERSION_WITH_PARENT_ADDRESS && hasParentAddress) { - throw new RuntimeException("Parent addresses are only supported with versions " - + FormatSpec.FIRST_VERSION_WITH_PARENT_ADDRESS + " and ulterior."); - } - mHasParentAddress = hasParentAddress; - } - } - - /** - * Class representing file header. - */ - private static final class FileHeader { - public final int mHeaderSize; - public final DictionaryOptions mDictionaryOptions; - public final FormatOptions mFormatOptions; - public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, - final FormatOptions formatOptions) { - mHeaderSize = headerSize; - mDictionaryOptions = dictionaryOptions; - mFormatOptions = formatOptions; - } - } - /** * A class grouping utility function for our specific character encoding. */ diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java index 1e2e93d90..1707ccc39 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.latin.Constants; +import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; /** * Dictionary File Format Specification. @@ -194,6 +195,40 @@ public final class FormatSpec { static final int MAX_TERMINAL_FREQUENCY = 255; static final int MAX_BIGRAM_FREQUENCY = 15; + /** + * Options about file format. + */ + public static class FormatOptions { + public final int mVersion; + public final boolean mHasParentAddress; + public FormatOptions(final int version) { + this(version, false); + } + public FormatOptions(final int version, final boolean hasParentAddress) { + mVersion = version; + if (version < FormatSpec.FIRST_VERSION_WITH_PARENT_ADDRESS && hasParentAddress) { + throw new RuntimeException("Parent addresses are only supported with versions " + + FormatSpec.FIRST_VERSION_WITH_PARENT_ADDRESS + " and ulterior."); + } + mHasParentAddress = hasParentAddress; + } + } + + /** + * Class representing file header. + */ + static final class FileHeader { + public final int mHeaderSize; + public final DictionaryOptions mDictionaryOptions; + public final FormatOptions mFormatOptions; + public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, + final FormatOptions formatOptions) { + mHeaderSize = headerSize; + mDictionaryOptions = dictionaryOptions; + mFormatOptions = formatOptions; + } + } + private FormatSpec() { // This utility class is not publicly instantiable. } diff --git a/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java index 5fa740f6e..70f916c1a 100644 --- a/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/UserHistoryDictIOUtilsTests.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import com.android.inputmethod.latin.UserHistoryDictIOUtils.BigramDictionaryInterface; import com.android.inputmethod.latin.UserHistoryDictIOUtils.OnAddWordListener; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FusionDictionary; import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup; @@ -45,8 +46,7 @@ public class UserHistoryDictIOUtilsTests extends AndroidTestCase private static final int UNIGRAM_FREQUENCY = 50; private static final int BIGRAM_FREQUENCY = 100; private static final ArrayList NOT_HAVE_BIGRAM = new ArrayList(); - private static final BinaryDictInputOutput.FormatOptions FORMAT_OPTIONS = - new BinaryDictInputOutput.FormatOptions(2); + private static final FormatSpec.FormatOptions FORMAT_OPTIONS = new FormatSpec.FormatOptions(2); /** * Return same frequency for all words and bigrams diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java index 523287b48..5d9c229e3 100644 --- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java +++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.UserHistoryDictIOUtils; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput.FusionDictionaryBufferInterface; +import com.android.inputmethod.latin.makedict.FormatSpec; import com.android.inputmethod.latin.makedict.FusionDictionary.CharGroup; import com.android.inputmethod.latin.makedict.FusionDictionary.Node; import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString; @@ -62,8 +63,7 @@ public class BinaryDictIOTests extends AndroidTestCase { private static final SparseArray> sChainBigrams = CollectionUtils.newSparseArray(); - private static final BinaryDictInputOutput.FormatOptions VERSION2 = - new BinaryDictInputOutput.FormatOptions(2); + private static final FormatSpec.FormatOptions VERSION2 = new FormatSpec.FormatOptions(2); private static final String[] CHARACTERS = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", diff --git a/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java b/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java index 7cd4564f3..a6137706e 100644 --- a/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java +++ b/tools/dicttool/src/android/inputmethod/latin/dicttool/DictionaryMaker.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.dicttool; import com.android.inputmethod.latin.makedict.BinaryDictInputOutput; +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; @@ -311,8 +312,7 @@ public class DictionaryMaker { final FusionDictionary dict, final int version) throws FileNotFoundException, IOException, UnsupportedFormatException { final File outputFile = new File(outputFilename); - final BinaryDictInputOutput.FormatOptions formatOptions = - new BinaryDictInputOutput.FormatOptions(version); + final FormatSpec.FormatOptions formatOptions = new FormatSpec.FormatOptions(version); BinaryDictInputOutput.writeDictionaryBinary(new FileOutputStream(outputFilename), dict, formatOptions); } -- cgit v1.2.3-83-g751a