diff options
author | 2014-01-15 16:04:05 +0900 | |
---|---|---|
committer | 2014-01-15 16:14:53 +0900 | |
commit | 7b9b09509083af20019828972f9558336ec7da7a (patch) | |
tree | 4df1b6f7b5e5369dd888ffc3e26377f361e5b25a /java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java | |
parent | 2d1e72b774ee495d1483b6b9876d7d2d58fb6f46 (diff) | |
download | latinime-7b9b09509083af20019828972f9558336ec7da7a.tar.gz latinime-7b9b09509083af20019828972f9558336ec7da7a.tar.xz latinime-7b9b09509083af20019828972f9558336ec7da7a.zip |
Move LanguageModelParams class to utility package
This change must be checked in together with Ic82d951237.
Change-Id: I2ab451330f85a0147563b805682f26edecb71a29
Diffstat (limited to 'java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java b/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java new file mode 100644 index 000000000..847b7bb91 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/utils/LanguageModelParam.java @@ -0,0 +1,65 @@ +/* + * 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.utils; + +import com.android.inputmethod.latin.Dictionary; + +public class LanguageModelParam { + public final String mTargetWord; + public final int[] mWord0; + public final int[] mWord1; + // TODO: this needs to be a list of shortcuts + public final int[] mShortcutTarget; + public final int mUnigramProbability; + public final int mBigramProbability; + public final int mShortcutProbability; + public final boolean mIsNotAWord; + public final boolean mIsBlacklisted; + // Time stamp in seconds. + public final int mTimestamp; + + // Constructor for unigram. TODO: support shortcuts + public LanguageModelParam(final String word, final int unigramProbability, + final int timestamp) { + mTargetWord = word; + mWord0 = null; + mWord1 = StringUtils.toCodePointArray(word); + mShortcutTarget = null; + mUnigramProbability = unigramProbability; + mBigramProbability = Dictionary.NOT_A_PROBABILITY; + mShortcutProbability = Dictionary.NOT_A_PROBABILITY; + mIsNotAWord = false; + mIsBlacklisted = false; + mTimestamp = timestamp; + } + + // Constructor for unigram and bigram. + public LanguageModelParam(final String word0, final String word1, + final int unigramProbability, final int bigramProbability, + final int timestamp) { + mTargetWord = word1; + mWord0 = StringUtils.toCodePointArray(word0); + mWord1 = StringUtils.toCodePointArray(word1); + mShortcutTarget = null; + mUnigramProbability = unigramProbability; + mBigramProbability = bigramProbability; + mShortcutProbability = Dictionary.NOT_A_PROBABILITY; + mIsNotAWord = false; + mIsBlacklisted = false; + mTimestamp = timestamp; + } +} |