Skip to content
Snippets Groups Projects
Commit b8a2772b authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Consolidate LanguageModelParam constructors

Change-Id: I142651d1f268456a5901da524cbe55d315f76d28
parent 7b9b0950
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment