Skip to content
Snippets Groups Projects
Commit 6bb70115 authored by Dan Zivkovic's avatar Dan Zivkovic
Browse files

Read less data from the input connection.

Currently, we read 256 (max word size) * 5 (max N-gram size + 1) characters
from the input connection when building our context. This is overkill. We
don't need more than 80 characters, regardless of which decoder we use.

Bug 19987461.

Change-Id: Ie3a321cf2482adbacd8006d9d86e6601097c15ed
parent 3e66c635
No related branches found
No related tags found
No related merge requests found
...@@ -62,10 +62,10 @@ public final class RichInputConnection implements PrivateCommandPerformer { ...@@ -62,10 +62,10 @@ public final class RichInputConnection implements PrivateCommandPerformer {
private static final boolean DBG = false; private static final boolean DBG = false;
private static final boolean DEBUG_PREVIOUS_TEXT = false; private static final boolean DEBUG_PREVIOUS_TEXT = false;
private static final boolean DEBUG_BATCH_NESTING = false; private static final boolean DEBUG_BATCH_NESTING = false;
// Provision for long words and separators between the words. // Provision for realistic N-grams like "Hello, how are you?" and "I'm running 5 late".
private static final int LOOKBACK_CHARACTER_NUM = DICTIONARY_MAX_WORD_LENGTH // Technically, this will not handle 5-grams composed of long words, but in practice,
* (DecoderSpecificConstants.MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1) /* words */ // our language models don't include that much data.
+ DecoderSpecificConstants.MAX_PREV_WORD_COUNT_FOR_N_GRAM /* separators */; private static final int LOOKBACK_CHARACTER_NUM = 80;
private static final int INVALID_CURSOR_POSITION = -1; private static final int INVALID_CURSOR_POSITION = -1;
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment