aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/MainLogBuffer.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2013-02-21 15:54:42 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-02-21 15:54:42 -0800
commit8375f4f2c584b62c0d0cf528aba37188111c218b (patch)
tree7d5ae80ceef9033a30cc674e69f055d67f2e0b8b /java/src/com/android/inputmethod/research/MainLogBuffer.java
parent8cda5578245d8bc09b2897341c9cbf1ce42a68db (diff)
parent07050549b1f91a787fadb553cc834f9833617041 (diff)
downloadlatinime-8375f4f2c584b62c0d0cf528aba37188111c218b.tar.gz
latinime-8375f4f2c584b62c0d0cf528aba37188111c218b.tar.xz
latinime-8375f4f2c584b62c0d0cf528aba37188111c218b.zip
am 07050549: Merge "[TestPrep5] Parameterize MainLogBuffer"
* commit '07050549b1f91a787fadb553cc834f9833617041': [TestPrep5] Parameterize MainLogBuffer
Diffstat (limited to 'java/src/com/android/inputmethod/research/MainLogBuffer.java')
-rw-r--r--java/src/com/android/inputmethod/research/MainLogBuffer.java20
1 files changed, 5 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java
index 3dfc349b4..45b83dd76 100644
--- a/java/src/com/android/inputmethod/research/MainLogBuffer.java
+++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java
@@ -64,15 +64,6 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
// The size of the n-grams logged. E.g. N_GRAM_SIZE = 2 means to sample bigrams.
public static final int N_GRAM_SIZE = 2;
- // Whether all words should be recorded, leaving unsampled word between bigrams. Useful for
- // testing.
- /* package for test */ static final boolean IS_LOGGING_EVERYTHING = false
- && ProductionFlag.IS_EXPERIMENTAL_DEBUG;
-
- // The number of words between n-grams to omit from the log.
- private static final int DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES =
- IS_LOGGING_EVERYTHING ? 0 : (DEBUG ? 2 : 18);
-
private Suggest mSuggest;
private boolean mIsStopping = false;
@@ -82,11 +73,10 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
// after a sample is taken.
/* package for test */ int mNumWordsUntilSafeToSample;
- public MainLogBuffer() {
- super(N_GRAM_SIZE + DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES);
- mNumWordsBetweenNGrams = DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES;
- final Random random = new Random();
- mNumWordsUntilSafeToSample = DEBUG ? 0 : random.nextInt(mNumWordsBetweenNGrams + 1);
+ public MainLogBuffer(final int wordsBetweenSamples, final int numInitialWordsToIgnore) {
+ super(N_GRAM_SIZE + wordsBetweenSamples);
+ mNumWordsBetweenNGrams = wordsBetweenSamples;
+ mNumWordsUntilSafeToSample = DEBUG ? 0 : numInitialWordsToIgnore;
}
public void setSuggest(final Suggest suggest) {
@@ -119,7 +109,7 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
*/
private boolean isSafeNGram(final ArrayList<LogUnit> logUnits, final int minNGramSize) {
// Bypass privacy checks when debugging.
- if (IS_LOGGING_EVERYTHING) {
+ if (ResearchLogger.IS_LOGGING_EVERYTHING) {
if (mIsStopping) {
return true;
}