am b8a2772b: Consolidate LanguageModelParam constructors

* commit 'b8a2772b0e0367bc98b897f8b464e1dd042511df':
  Consolidate LanguageModelParam constructors
main
Tadashi G. Takaoka 2014-01-15 00:36:30 -08:00 committed by Android Git Automerger
commit 88b4d1c90e
1 changed files with 2 additions and 11 deletions

View File

@ -35,16 +35,7 @@ public class LanguageModelParam {
// 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;
this(null /* word0 */, word, unigramProbability, Dictionary.NOT_A_PROBABILITY, timestamp);
}
// Constructor for unigram and bigram.
@ -52,7 +43,7 @@ public class LanguageModelParam {
final int unigramProbability, final int bigramProbability,
final int timestamp) {
mTargetWord = word1;
mWord0 = StringUtils.toCodePointArray(word0);
mWord0 = (word0 == null) ? null : StringUtils.toCodePointArray(word0);
mWord1 = StringUtils.toCodePointArray(word1);
mShortcutTarget = null;
mUnigramProbability = unigramProbability;