Merge "Change default decaying parameters."

main
Keisuke Kuroyanagi 2014-03-14 06:16:01 +00:00 committed by Android (Google) Code Review
commit 599e61d70c
4 changed files with 13 additions and 28 deletions

View File

@ -47,11 +47,11 @@ const char *const HeaderPolicy::MAX_BIGRAM_COUNT_KEY = "MAX_BIGRAM_COUNT";
const int HeaderPolicy::DEFAULT_MULTIPLE_WORDS_DEMOTION_RATE = 100; const int HeaderPolicy::DEFAULT_MULTIPLE_WORDS_DEMOTION_RATE = 100;
const float HeaderPolicy::MULTIPLE_WORD_COST_MULTIPLIER_SCALE = 100.0f; const float HeaderPolicy::MULTIPLE_WORD_COST_MULTIPLIER_SCALE = 100.0f;
const int HeaderPolicy::DEFAULT_FORGETTING_CURVE_OCCURRENCES_TO_LEVEL_UP = 4; const int HeaderPolicy::DEFAULT_FORGETTING_CURVE_OCCURRENCES_TO_LEVEL_UP = 2;
const int HeaderPolicy::DEFAULT_FORGETTING_CURVE_PROBABILITY_VALUES_TABLE_ID = 0; const int HeaderPolicy::DEFAULT_FORGETTING_CURVE_PROBABILITY_VALUES_TABLE_ID = 3;
// 4 days // 30 days
const int HeaderPolicy::DEFAULT_FORGETTING_CURVE_DURATION_TO_LEVEL_DOWN_IN_SECONDS = const int HeaderPolicy::DEFAULT_FORGETTING_CURVE_DURATION_TO_LEVEL_DOWN_IN_SECONDS =
4 * 24 * 60 * 60; 30 * 24 * 60 * 60;
const int HeaderPolicy::DEFAULT_MAX_UNIGRAM_COUNT = 10000; const int HeaderPolicy::DEFAULT_MAX_UNIGRAM_COUNT = 10000;
const int HeaderPolicy::DEFAULT_MAX_BIGRAM_COUNT = 10000; const int HeaderPolicy::DEFAULT_MAX_BIGRAM_COUNT = 10000;

View File

@ -75,16 +75,16 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
} }
private void forcePassingShortTime(final BinaryDictionary binaryDictionary) { private void forcePassingShortTime(final BinaryDictionary binaryDictionary) {
// 4 days. // 30 days.
final int timeToElapse = (int)TimeUnit.SECONDS.convert(4, TimeUnit.DAYS); final int timeToElapse = (int)TimeUnit.SECONDS.convert(30, TimeUnit.DAYS);
mCurrentTime += timeToElapse; mCurrentTime += timeToElapse;
setCurrentTimeForTestMode(mCurrentTime); setCurrentTimeForTestMode(mCurrentTime);
binaryDictionary.flushWithGC(); binaryDictionary.flushWithGC();
} }
private void forcePassingLongTime(final BinaryDictionary binaryDictionary) { private void forcePassingLongTime(final BinaryDictionary binaryDictionary) {
// 60 days. // 365 days.
final int timeToElapse = (int)TimeUnit.SECONDS.convert(60, TimeUnit.DAYS); final int timeToElapse = (int)TimeUnit.SECONDS.convert(365, TimeUnit.DAYS);
mCurrentTime += timeToElapse; mCurrentTime += timeToElapse;
setCurrentTimeForTestMode(mCurrentTime); setCurrentTimeForTestMode(mCurrentTime);
binaryDictionary.flushWithGC(); binaryDictionary.flushWithGC();
@ -210,19 +210,12 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY); addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY);
assertFalse(binaryDictionary.isValidWord("a")); assertFalse(binaryDictionary.isValidWord("a"));
addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY); addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY);
assertFalse(binaryDictionary.isValidWord("a"));
addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY);
assertFalse(binaryDictionary.isValidWord("a"));
addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY); addUnigramWord(binaryDictionary, "a", Dictionary.NOT_A_PROBABILITY);
assertTrue(binaryDictionary.isValidWord("a")); assertTrue(binaryDictionary.isValidWord("a"));
addUnigramWord(binaryDictionary, "b", DUMMY_PROBABILITY); addUnigramWord(binaryDictionary, "b", DUMMY_PROBABILITY);
assertTrue(binaryDictionary.isValidWord("b")); assertTrue(binaryDictionary.isValidWord("b"));
addBigramWords(binaryDictionary, "a", "b", Dictionary.NOT_A_PROBABILITY);
assertFalse(binaryDictionary.isValidBigram("a", "b"));
addBigramWords(binaryDictionary, "a", "b", Dictionary.NOT_A_PROBABILITY);
assertFalse(binaryDictionary.isValidBigram("a", "b"));
addBigramWords(binaryDictionary, "a", "b", Dictionary.NOT_A_PROBABILITY); addBigramWords(binaryDictionary, "a", "b", Dictionary.NOT_A_PROBABILITY);
assertFalse(binaryDictionary.isValidBigram("a", "b")); assertFalse(binaryDictionary.isValidBigram("a", "b"));
addBigramWords(binaryDictionary, "a", "b", Dictionary.NOT_A_PROBABILITY); addBigramWords(binaryDictionary, "a", "b", Dictionary.NOT_A_PROBABILITY);
@ -262,8 +255,6 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
forcePassingShortTime(binaryDictionary); forcePassingShortTime(binaryDictionary);
assertFalse(binaryDictionary.isValidWord("a")); assertFalse(binaryDictionary.isValidWord("a"));
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY); addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY); addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY); addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
@ -289,12 +280,6 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY); addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "b", DUMMY_PROBABILITY); addUnigramWord(binaryDictionary, "b", DUMMY_PROBABILITY);
addBigramWords(binaryDictionary, "a", "b", DUMMY_PROBABILITY); addBigramWords(binaryDictionary, "a", "b", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "b", DUMMY_PROBABILITY);
addBigramWords(binaryDictionary, "a", "b", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "a", DUMMY_PROBABILITY);
addUnigramWord(binaryDictionary, "b", DUMMY_PROBABILITY);
addBigramWords(binaryDictionary, "a", "b", DUMMY_PROBABILITY);
assertTrue(binaryDictionary.isValidBigram("a", "b")); assertTrue(binaryDictionary.isValidBigram("a", "b"));
forcePassingShortTime(binaryDictionary); forcePassingShortTime(binaryDictionary);
assertTrue(binaryDictionary.isValidBigram("a", "b")); assertTrue(binaryDictionary.isValidBigram("a", "b"));
@ -370,7 +355,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
private void testOverflowUnigrams(final int formatVersion) { private void testOverflowUnigrams(final int formatVersion) {
final int unigramCount = 20000; final int unigramCount = 20000;
final int eachUnigramTypedCount = 5; final int eachUnigramTypedCount = 2;
final int strongUnigramTypedCount = 20; final int strongUnigramTypedCount = 20;
final int weakUnigramTypedCount = 1; final int weakUnigramTypedCount = 1;
final int codePointSetSize = 50; final int codePointSetSize = 50;
@ -505,7 +490,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
final int bigramCount = 20000; final int bigramCount = 20000;
final int unigramCount = 1000; final int unigramCount = 1000;
final int unigramTypedCount = 20; final int unigramTypedCount = 20;
final int eachBigramTypedCount = 5; final int eachBigramTypedCount = 2;
final int strongBigramTypedCount = 20; final int strongBigramTypedCount = 20;
final int weakBigramTypedCount = 1; final int weakBigramTypedCount = 1;
final int codePointSetSize = 50; final int codePointSetSize = 50;

View File

@ -356,7 +356,7 @@ public class InputLogicTests extends InputTestsBase {
final String NOT_CORRECTED_RESULT = "qpmx "; final String NOT_CORRECTED_RESULT = "qpmx ";
final String DESIRED_WORD = "qpmz"; final String DESIRED_WORD = "qpmz";
final String CORRECTED_RESULT = "qpmz "; final String CORRECTED_RESULT = "qpmz ";
final int typeCountNotToAutocorrect = 3; final int typeCountNotToAutocorrect = 1;
final int typeCountToAutoCorrect = 16; final int typeCountToAutoCorrect = 16;
int startIndex = 0; int startIndex = 0;
int endIndex = 0; int endIndex = 0;

View File

@ -72,8 +72,8 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
} }
private void forcePassingLongTime() { private void forcePassingLongTime() {
// 60 days. // 365 days.
final int timeToElapse = (int)TimeUnit.DAYS.toSeconds(60); final int timeToElapse = (int)TimeUnit.DAYS.toSeconds(365);
mCurrentTime += timeToElapse; mCurrentTime += timeToElapse;
setCurrentTimeForTestMode(mCurrentTime); setCurrentTimeForTestMode(mCurrentTime);
} }