Add a addOrIncrement term api to DicFacilitator

The API is used by the decoder to add term to the
dictionary.

Change-Id: I607c8c676b7650f3052b2d3ed3f7f656573fca45
main
Jatin Matani 2015-02-06 13:24:30 -08:00
parent 644a709a5f
commit a7805e9870
3 changed files with 20 additions and 1 deletions

View File

@ -171,4 +171,10 @@ public interface DictionaryFacilitator {
void dumpDictionaryForDebug(final String dictName); void dumpDictionaryForDebug(final String dictName);
ArrayList<Pair<String, DictionaryStats>> getStatsOfEnabledSubDicts(); ArrayList<Pair<String, DictionaryStats>> getStatsOfEnabledSubDicts();
void addOrIncrementTerm(String fileName,
String finalWordToBeAdded,
NgramContext ngramContext,
int increment,
int timeStampInSeconds);
} }

View File

@ -746,10 +746,12 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
return maxFreq; return maxFreq;
} }
@Override
public int getFrequency(final String word) { public int getFrequency(final String word) {
return getFrequencyInternal(word, false /* isGettingMaxFrequencyOfExactMatches */); return getFrequencyInternal(word, false /* isGettingMaxFrequencyOfExactMatches */);
} }
@Override
public int getMaxFrequencyOfExactMatches(final String word) { public int getMaxFrequencyOfExactMatches(final String word) {
return getFrequencyInternal(word, true /* isGettingMaxFrequencyOfExactMatches */); return getFrequencyInternal(word, true /* isGettingMaxFrequencyOfExactMatches */);
} }
@ -793,4 +795,13 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
} }
return statsOfEnabledSubDicts; return statsOfEnabledSubDicts;
} }
@Override
public void addOrIncrementTerm(String fileName,
String word,
NgramContext ngramContext,
int increment,
int timeStampInSeconds) {
// Do nothing.
}
} }

View File

@ -108,7 +108,9 @@ public class NgramContext {
mPrevWordsCount = prevWordsInfo.length; mPrevWordsCount = prevWordsInfo.length;
} }
// Create next prevWordsInfo using current prevWordsInfo. /**
* Create next prevWordsInfo using current prevWordsInfo.
*/
@Nonnull @Nonnull
public NgramContext getNextNgramContext(final WordInfo wordInfo) { public NgramContext getNextNgramContext(final WordInfo wordInfo) {
final int nextPrevWordCount = Math.min( final int nextPrevWordCount = Math.min(