Write forgetting curve flag.
Bug: 6669677 Change-Id: Ic19aa3b69fb45d9638f9dcc8c3dd8a34aad41965main
parent
5901b5e1bd
commit
859b9eeaf0
|
@ -34,6 +34,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads and writes Binary files for a UserHistoryDictionary.
|
* Reads and writes Binary files for a UserHistoryDictionary.
|
||||||
|
@ -43,6 +44,9 @@ import java.util.TreeMap;
|
||||||
public final class UserHistoryDictIOUtils {
|
public final class UserHistoryDictIOUtils {
|
||||||
private static final String TAG = UserHistoryDictIOUtils.class.getSimpleName();
|
private static final String TAG = UserHistoryDictIOUtils.class.getSimpleName();
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
private static final String USES_FORGETTING_CURVE_KEY = "USES_FORGETTING_CURVE";
|
||||||
|
private static final String USES_FORGETTING_CURVE_VALUE = "1";
|
||||||
|
private static final String LAST_UPDATED_TIME_KEY = "date";
|
||||||
|
|
||||||
public interface OnAddWordListener {
|
public interface OnAddWordListener {
|
||||||
public void setUnigram(final String word, final String shortcutTarget, final int frequency);
|
public void setUnigram(final String word, final String shortcutTarget, final int frequency);
|
||||||
|
@ -61,6 +65,9 @@ public final class UserHistoryDictIOUtils {
|
||||||
final BigramDictionaryInterface dict, final UserHistoryDictionaryBigramList bigrams,
|
final BigramDictionaryInterface dict, final UserHistoryDictionaryBigramList bigrams,
|
||||||
final FormatOptions formatOptions) {
|
final FormatOptions formatOptions) {
|
||||||
final FusionDictionary fusionDict = constructFusionDictionary(dict, bigrams);
|
final FusionDictionary fusionDict = constructFusionDictionary(dict, bigrams);
|
||||||
|
fusionDict.addOptionAttribute(USES_FORGETTING_CURVE_KEY, USES_FORGETTING_CURVE_VALUE);
|
||||||
|
fusionDict.addOptionAttribute(LAST_UPDATED_TIME_KEY,
|
||||||
|
String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));
|
||||||
try {
|
try {
|
||||||
dictEncoder.writeDictionary(fusionDict, formatOptions);
|
dictEncoder.writeDictionary(fusionDict, formatOptions);
|
||||||
Log.d(TAG, "end writing");
|
Log.d(TAG, "end writing");
|
||||||
|
|
Loading…
Reference in New Issue