diff options
author | 2024-12-16 21:45:41 -0500 | |
---|---|---|
committer | 2025-01-11 14:17:35 -0500 | |
commit | e9a0e66716dab4dd3184d009d8920de1961efdfa (patch) | |
tree | 02dcc096643d74645bf28459c2834c3d4a2ad7f2 /java/src/com/android/inputmethod/latin/makedict/DictionaryHeader.java | |
parent | fb3b9360d70596d7e921de8bf7d3ca99564a077e (diff) | |
download | latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.tar.gz latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.tar.xz latinime-e9a0e66716dab4dd3184d009d8920de1961efdfa.zip |
Rename to Kelar Keyboard (org.kelar.inputmethod.latin)
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/DictionaryHeader.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/DictionaryHeader.java | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/DictionaryHeader.java b/java/src/com/android/inputmethod/latin/makedict/DictionaryHeader.java deleted file mode 100644 index 4d253b0cb..000000000 --- a/java/src/com/android/inputmethod/latin/makedict/DictionaryHeader.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2014 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.latin.makedict.FormatSpec.DictionaryOptions; -import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * Class representing dictionary header. - */ -public final class DictionaryHeader { - public final int mBodyOffset; - @Nonnull - public final DictionaryOptions mDictionaryOptions; - @Nonnull - public final FormatOptions mFormatOptions; - @Nonnull - public final String mLocaleString; - @Nonnull - public final String mVersionString; - @Nonnull - public final String mIdString; - - // Note that these are corresponding definitions in native code in latinime::HeaderPolicy - // and latinime::HeaderReadWriteUtils. - // 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 FORGETTING_CURVE_PROBABILITY_VALUES_TABLE_ID_KEY = - "FORGETTING_CURVE_PROBABILITY_VALUES_TABLE_ID"; - public static final String MAX_UNIGRAM_COUNT_KEY = "MAX_UNIGRAM_ENTRY_COUNT"; - public static final String MAX_BIGRAM_COUNT_KEY = "MAX_BIGRAM_ENTRY_COUNT"; - public static final String MAX_TRIGRAM_COUNT_KEY = "MAX_TRIGRAM_ENTRY_COUNT"; - public static final String ATTRIBUTE_VALUE_TRUE = "1"; - public static final String CODE_POINT_TABLE_KEY = "codePointTable"; - - public DictionaryHeader(final int headerSize, - @Nonnull final DictionaryOptions dictionaryOptions, - @Nonnull final FormatOptions formatOptions) throws UnsupportedFormatException { - mDictionaryOptions = dictionaryOptions; - mFormatOptions = formatOptions; - mBodyOffset = formatOptions.mVersion < FormatSpec.VERSION4 ? headerSize : 0; - final String localeString = dictionaryOptions.mAttributes.get(DICTIONARY_LOCALE_KEY); - if (null == localeString) { - throw new UnsupportedFormatException("Cannot create a FileHeader without a locale"); - } - final String versionString = dictionaryOptions.mAttributes.get(DICTIONARY_VERSION_KEY); - if (null == versionString) { - throw new UnsupportedFormatException( - "Cannot create a FileHeader without a version"); - } - final String idString = dictionaryOptions.mAttributes.get(DICTIONARY_ID_KEY); - if (null == idString) { - throw new UnsupportedFormatException("Cannot create a FileHeader without an ID"); - } - mLocaleString = localeString; - mVersionString = versionString; - mIdString = idString; - } - - // Helper method to get the description - @Nullable - 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(DICTIONARY_DESCRIPTION_KEY); - } -}
\ No newline at end of file |