Add a addOrIncrement term api to DicFacilitator
The API is used by the decoder to add term to the dictionary. Change-Id: I607c8c676b7650f3052b2d3ed3f7f656573fca45main
parent
644a709a5f
commit
a7805e9870
|
@ -171,4 +171,10 @@ public interface DictionaryFacilitator {
|
|||
void dumpDictionaryForDebug(final String dictName);
|
||||
|
||||
ArrayList<Pair<String, DictionaryStats>> getStatsOfEnabledSubDicts();
|
||||
|
||||
void addOrIncrementTerm(String fileName,
|
||||
String finalWordToBeAdded,
|
||||
NgramContext ngramContext,
|
||||
int increment,
|
||||
int timeStampInSeconds);
|
||||
}
|
||||
|
|
|
@ -746,10 +746,12 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
|||
return maxFreq;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFrequency(final String word) {
|
||||
return getFrequencyInternal(word, false /* isGettingMaxFrequencyOfExactMatches */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFrequencyOfExactMatches(final String word) {
|
||||
return getFrequencyInternal(word, true /* isGettingMaxFrequencyOfExactMatches */);
|
||||
}
|
||||
|
@ -793,4 +795,13 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
|||
}
|
||||
return statsOfEnabledSubDicts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOrIncrementTerm(String fileName,
|
||||
String word,
|
||||
NgramContext ngramContext,
|
||||
int increment,
|
||||
int timeStampInSeconds) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,9 @@ public class NgramContext {
|
|||
mPrevWordsCount = prevWordsInfo.length;
|
||||
}
|
||||
|
||||
// Create next prevWordsInfo using current prevWordsInfo.
|
||||
/**
|
||||
* Create next prevWordsInfo using current prevWordsInfo.
|
||||
*/
|
||||
@Nonnull
|
||||
public NgramContext getNextNgramContext(final WordInfo wordInfo) {
|
||||
final int nextPrevWordCount = Math.min(
|
||||
|
|
Loading…
Reference in New Issue