Consolidate LanguageModelParam constructors
Change-Id: I142651d1f268456a5901da524cbe55d315f76d28
This commit is contained in:
parent
7b9b095090
commit
b8a2772b0e
1 changed files with 2 additions and 11 deletions
|
@ -35,16 +35,7 @@ public class LanguageModelParam {
|
||||||
// Constructor for unigram. TODO: support shortcuts
|
// Constructor for unigram. TODO: support shortcuts
|
||||||
public LanguageModelParam(final String word, final int unigramProbability,
|
public LanguageModelParam(final String word, final int unigramProbability,
|
||||||
final int timestamp) {
|
final int timestamp) {
|
||||||
mTargetWord = word;
|
this(null /* word0 */, word, unigramProbability, Dictionary.NOT_A_PROBABILITY, timestamp);
|
||||||
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.
|
// Constructor for unigram and bigram.
|
||||||
|
@ -52,7 +43,7 @@ public class LanguageModelParam {
|
||||||
final int unigramProbability, final int bigramProbability,
|
final int unigramProbability, final int bigramProbability,
|
||||||
final int timestamp) {
|
final int timestamp) {
|
||||||
mTargetWord = word1;
|
mTargetWord = word1;
|
||||||
mWord0 = StringUtils.toCodePointArray(word0);
|
mWord0 = (word0 == null) ? null : StringUtils.toCodePointArray(word0);
|
||||||
mWord1 = StringUtils.toCodePointArray(word1);
|
mWord1 = StringUtils.toCodePointArray(word1);
|
||||||
mShortcutTarget = null;
|
mShortcutTarget = null;
|
||||||
mUnigramProbability = unigramProbability;
|
mUnigramProbability = unigramProbability;
|
||||||
|
|
Loading…
Reference in a new issue