Merge "Pass long timestamps to DictionaryFacilitator"
This commit is contained in:
commit
f7058c2a89
3 changed files with 6 additions and 6 deletions
|
@ -147,11 +147,11 @@ public interface DictionaryFacilitator {
|
||||||
throws InterruptedException;
|
throws InterruptedException;
|
||||||
|
|
||||||
void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
|
void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
|
||||||
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
|
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
|
||||||
final boolean blockPotentiallyOffensive);
|
final boolean blockPotentiallyOffensive);
|
||||||
|
|
||||||
void unlearnFromUserHistory(final String word,
|
void unlearnFromUserHistory(final String word,
|
||||||
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
|
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
|
||||||
final int eventType);
|
final int eventType);
|
||||||
|
|
||||||
// TODO: Revise the way to fusion suggestion results.
|
// TODO: Revise the way to fusion suggestion results.
|
||||||
|
|
|
@ -579,7 +579,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
|
public void addToUserHistory(final String suggestion, final boolean wasAutoCapitalized,
|
||||||
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
|
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
|
||||||
final boolean blockPotentiallyOffensive) {
|
final boolean blockPotentiallyOffensive) {
|
||||||
final DictionaryGroup dictionaryGroup = getDictionaryGroupForMostProbableLanguage();
|
final DictionaryGroup dictionaryGroup = getDictionaryGroupForMostProbableLanguage();
|
||||||
final String[] words = suggestion.split(Constants.WORD_SEPARATOR);
|
final String[] words = suggestion.split(Constants.WORD_SEPARATOR);
|
||||||
|
@ -588,7 +588,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
final String currentWord = words[i];
|
final String currentWord = words[i];
|
||||||
final boolean wasCurrentWordAutoCapitalized = (i == 0) ? wasAutoCapitalized : false;
|
final boolean wasCurrentWordAutoCapitalized = (i == 0) ? wasAutoCapitalized : false;
|
||||||
addWordToUserHistory(dictionaryGroup, ngramContextForCurrentWord, currentWord,
|
addWordToUserHistory(dictionaryGroup, ngramContextForCurrentWord, currentWord,
|
||||||
wasCurrentWordAutoCapitalized, timeStampInSeconds, blockPotentiallyOffensive);
|
wasCurrentWordAutoCapitalized, (int) timeStampInSeconds, blockPotentiallyOffensive);
|
||||||
ngramContextForCurrentWord =
|
ngramContextForCurrentWord =
|
||||||
ngramContextForCurrentWord.getNextNgramContext(new WordInfo(currentWord));
|
ngramContextForCurrentWord.getNextNgramContext(new WordInfo(currentWord));
|
||||||
}
|
}
|
||||||
|
@ -656,7 +656,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unlearnFromUserHistory(final String word,
|
public void unlearnFromUserHistory(final String word,
|
||||||
@Nonnull final NgramContext ngramContext, final int timeStampInSeconds,
|
@Nonnull final NgramContext ngramContext, final long timeStampInSeconds,
|
||||||
final int eventType) {
|
final int eventType) {
|
||||||
// TODO: Decide whether or not to remove the word on EVENT_BACKSPACE.
|
// TODO: Decide whether or not to remove the word on EVENT_BACKSPACE.
|
||||||
if (eventType != Constants.EVENT_BACKSPACE) {
|
if (eventType != Constants.EVENT_BACKSPACE) {
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ public final class InputLogic {
|
||||||
void unlearnWord(final String word, final SettingsValues settingsValues, final int eventType) {
|
void unlearnWord(final String word, final SettingsValues settingsValues, final int eventType) {
|
||||||
final NgramContext ngramContext = mConnection.getNgramContextFromNthPreviousWord(
|
final NgramContext ngramContext = mConnection.getNgramContextFromNthPreviousWord(
|
||||||
settingsValues.mSpacingAndPunctuations, 2);
|
settingsValues.mSpacingAndPunctuations, 2);
|
||||||
final int timeStampInSeconds = (int)TimeUnit.MILLISECONDS.toSeconds(
|
final long timeStampInSeconds = TimeUnit.MILLISECONDS.toSeconds(
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
mDictionaryFacilitator.unlearnFromUserHistory(
|
mDictionaryFacilitator.unlearnFromUserHistory(
|
||||||
word, ngramContext, timeStampInSeconds, eventType);
|
word, ngramContext, timeStampInSeconds, eventType);
|
||||||
|
|
Loading…
Reference in a new issue