Loading java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +3 −3 Original line number Diff line number Diff line Loading @@ -267,9 +267,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected Map<String, String> getHeaderAttributeMap() { HashMap<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_ATTRIBUTE, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_KEY, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); return attributeMap; } Loading java/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ public abstract class AbstractDictDecoder implements DictDecoder { final FileHeader header = new FileHeader(headerSize, new FusionDictionary.DictionaryOptions(attributes), new FormatOptions(version, FileHeader.ATTRIBUTE_VALUE_TRUE.equals( attributes.get(FileHeader.HAS_HISTORICAL_INFO_ATTRIBUTE)))); attributes.get(FileHeader.HAS_HISTORICAL_INFO_KEY)))); return header; } Loading java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +14 −11 Original line number Diff line number Diff line Loading @@ -336,16 +336,19 @@ public final class FormatSpec { public final int mBodyOffset; public final DictionaryOptions mDictionaryOptions; public final FormatOptions mFormatOptions; // Note that these are corresponding definitions in native code in latinime::HeaderPolicy // and latinime::HeaderReadWriteUtils. public static final String USES_FORGETTING_CURVE_ATTRIBUTE = "USES_FORGETTING_CURVE"; public static final String HAS_HISTORICAL_INFO_ATTRIBUTE = "HAS_HISTORICAL_INFO"; // TODO: Standardize the key names and bump up the format version, taking care not to // break format version 2 dictionaries. public static final String DICTIONARY_VERSION_KEY = "version"; public static final String DICTIONARY_LOCALE_KEY = "locale"; public static final String DICTIONARY_ID_KEY = "dictionary"; public static final String DICTIONARY_DESCRIPTION_KEY = "description"; public static final String DICTIONARY_DATE_KEY = "date"; public static final String HAS_HISTORICAL_INFO_KEY = "HAS_HISTORICAL_INFO"; public static final String USES_FORGETTING_CURVE_KEY = "USES_FORGETTING_CURVE"; public static final String ATTRIBUTE_VALUE_TRUE = "1"; public static final String DICTIONARY_VERSION_ATTRIBUTE = "version"; public static final String DICTIONARY_LOCALE_ATTRIBUTE = "locale"; public static final String DICTIONARY_ID_ATTRIBUTE = "dictionary"; private static final String DICTIONARY_DESCRIPTION_ATTRIBUTE = "description"; public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, final FormatOptions formatOptions) throws UnsupportedFormatException { mDictionaryOptions = dictionaryOptions; Loading @@ -365,24 +368,24 @@ public final class FormatSpec { // Helper method to get the locale as a String public String getLocaleString() { return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_LOCALE_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_LOCALE_KEY); } // Helper method to get the version String public String getVersion() { return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_VERSION_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_VERSION_KEY); } // Helper method to get the dictionary ID as a String public String getId() { return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_ID_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_ID_KEY); } // Helper method to get the description public String getDescription() { // TODO: Right now each dictionary file comes with a description in its own language. // It will display as is no matter the device's locale. It should be internationalized. return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_DESCRIPTION_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_DESCRIPTION_KEY); } } Loading java/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class Ver4DictEncoder implements DictEncoder { final BinaryDictionary binaryDict = new BinaryDictionary(mDictPlacedDir.getAbsolutePath(), 0l, mDictPlacedDir.length(), true /* useFullEditDistance */, LocaleUtils.constructLocaleFromString(dict.mOptions.mAttributes.get( FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE)), FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY)), Dictionary.TYPE_USER /* Dictionary type. Does not matter for us */, true /* isUpdatable */); if (!binaryDict.isValidDictionary()) { Loading java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java +5 −5 Original line number Diff line number Diff line Loading @@ -95,13 +95,13 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB @Override protected Map<String, String> getHeaderAttributeMap() { HashMap<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.USES_FORGETTING_CURVE_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.USES_FORGETTING_CURVE_KEY, FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); attributeMap.put(FormatSpec.FileHeader.HAS_HISTORICAL_INFO_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.HAS_HISTORICAL_INFO_KEY, FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_ATTRIBUTE, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_KEY, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); return attributeMap; } Loading Loading
java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +3 −3 Original line number Diff line number Diff line Loading @@ -267,9 +267,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { protected Map<String, String> getHeaderAttributeMap() { HashMap<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_ATTRIBUTE, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_KEY, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); return attributeMap; } Loading
java/src/com/android/inputmethod/latin/makedict/AbstractDictDecoder.java +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ public abstract class AbstractDictDecoder implements DictDecoder { final FileHeader header = new FileHeader(headerSize, new FusionDictionary.DictionaryOptions(attributes), new FormatOptions(version, FileHeader.ATTRIBUTE_VALUE_TRUE.equals( attributes.get(FileHeader.HAS_HISTORICAL_INFO_ATTRIBUTE)))); attributes.get(FileHeader.HAS_HISTORICAL_INFO_KEY)))); return header; } Loading
java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +14 −11 Original line number Diff line number Diff line Loading @@ -336,16 +336,19 @@ public final class FormatSpec { public final int mBodyOffset; public final DictionaryOptions mDictionaryOptions; public final FormatOptions mFormatOptions; // Note that these are corresponding definitions in native code in latinime::HeaderPolicy // and latinime::HeaderReadWriteUtils. public static final String USES_FORGETTING_CURVE_ATTRIBUTE = "USES_FORGETTING_CURVE"; public static final String HAS_HISTORICAL_INFO_ATTRIBUTE = "HAS_HISTORICAL_INFO"; // TODO: Standardize the key names and bump up the format version, taking care not to // break format version 2 dictionaries. public static final String DICTIONARY_VERSION_KEY = "version"; public static final String DICTIONARY_LOCALE_KEY = "locale"; public static final String DICTIONARY_ID_KEY = "dictionary"; public static final String DICTIONARY_DESCRIPTION_KEY = "description"; public static final String DICTIONARY_DATE_KEY = "date"; public static final String HAS_HISTORICAL_INFO_KEY = "HAS_HISTORICAL_INFO"; public static final String USES_FORGETTING_CURVE_KEY = "USES_FORGETTING_CURVE"; public static final String ATTRIBUTE_VALUE_TRUE = "1"; public static final String DICTIONARY_VERSION_ATTRIBUTE = "version"; public static final String DICTIONARY_LOCALE_ATTRIBUTE = "locale"; public static final String DICTIONARY_ID_ATTRIBUTE = "dictionary"; private static final String DICTIONARY_DESCRIPTION_ATTRIBUTE = "description"; public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, final FormatOptions formatOptions) throws UnsupportedFormatException { mDictionaryOptions = dictionaryOptions; Loading @@ -365,24 +368,24 @@ public final class FormatSpec { // Helper method to get the locale as a String public String getLocaleString() { return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_LOCALE_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_LOCALE_KEY); } // Helper method to get the version String public String getVersion() { return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_VERSION_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_VERSION_KEY); } // Helper method to get the dictionary ID as a String public String getId() { return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_ID_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_ID_KEY); } // Helper method to get the description public String getDescription() { // TODO: Right now each dictionary file comes with a description in its own language. // It will display as is no matter the device's locale. It should be internationalized. return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_DESCRIPTION_ATTRIBUTE); return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_DESCRIPTION_KEY); } } Loading
java/src/com/android/inputmethod/latin/makedict/Ver4DictEncoder.java +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class Ver4DictEncoder implements DictEncoder { final BinaryDictionary binaryDict = new BinaryDictionary(mDictPlacedDir.getAbsolutePath(), 0l, mDictPlacedDir.length(), true /* useFullEditDistance */, LocaleUtils.constructLocaleFromString(dict.mOptions.mAttributes.get( FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE)), FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY)), Dictionary.TYPE_USER /* Dictionary type. Does not matter for us */, true /* isUpdatable */); if (!binaryDict.isValidDictionary()) { Loading
java/src/com/android/inputmethod/latin/personalization/DecayingExpandableBinaryDictionaryBase.java +5 −5 Original line number Diff line number Diff line Loading @@ -95,13 +95,13 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB @Override protected Map<String, String> getHeaderAttributeMap() { HashMap<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.USES_FORGETTING_CURVE_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.USES_FORGETTING_CURVE_KEY, FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); attributeMap.put(FormatSpec.FileHeader.HAS_HISTORICAL_INFO_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.HAS_HISTORICAL_INFO_KEY, FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_ATTRIBUTE, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_ATTRIBUTE, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_ATTRIBUTE, attributeMap.put(FormatSpec.FileHeader.DICTIONARY_ID_KEY, mDictName); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_LOCALE_KEY, mLocale.toString()); attributeMap.put(FormatSpec.FileHeader.DICTIONARY_VERSION_KEY, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()))); return attributeMap; } Loading