diff options
author | 2010-08-19 22:46:06 -0700 | |
---|---|---|
committer | 2010-08-19 22:46:06 -0700 | |
commit | d56f8f5c10d6a959c23fda6ba0a588198fe7412b (patch) | |
tree | 9c26f81aa39c45fc0f22ecb2d5337e622b6a4438 /java/src/com/android/inputmethod/latin/Dictionary.java | |
parent | b608a93c0f3087b191c88cd75665886b7c52015e (diff) | |
parent | 979f8690967ff5409fe18f5085858ccdb8e0ccf1 (diff) | |
download | latinime-d56f8f5c10d6a959c23fda6ba0a588198fe7412b.tar.gz latinime-d56f8f5c10d6a959c23fda6ba0a588198fe7412b.tar.xz latinime-d56f8f5c10d6a959c23fda6ba0a588198fe7412b.zip |
am 979f8690: DO NOT MERGE. Backport LatinIME from master to Gingerbread
Merge commit '979f8690967ff5409fe18f5085858ccdb8e0ccf1' into gingerbread-plus-aosp
* commit '979f8690967ff5409fe18f5085858ccdb8e0ccf1':
DO NOT MERGE. Backport LatinIME from master to Gingerbread
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Dictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Dictionary.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/Dictionary.java b/java/src/com/android/inputmethod/latin/Dictionary.java index e7b526663..d04bf57a7 100644 --- a/java/src/com/android/inputmethod/latin/Dictionary.java +++ b/java/src/com/android/inputmethod/latin/Dictionary.java @@ -21,7 +21,6 @@ package com.android.inputmethod.latin; * strokes. */ abstract public class Dictionary { - /** * Whether or not to replicate the typed word in the suggested list, even if it's valid. */ @@ -31,7 +30,11 @@ abstract public class Dictionary { * The weight to give to a word if it's length is the same as the number of typed characters. */ protected static final int FULL_WORD_FREQ_MULTIPLIER = 2; - + + public static enum DataType { + UNIGRAM, BIGRAM + } + /** * Interface to be implemented by classes requesting words to be fetched from the dictionary. * @see #getWords(WordComposer, WordCallback) @@ -45,9 +48,12 @@ abstract public class Dictionary { * @param wordLength length of valid characters in the character array * @param frequency the frequency of occurence. This is normalized between 1 and 255, but * can exceed those limits + * @param dicTypeId of the dictionary where word was from + * @param dataType tells type of this data * @return true if the word was added, false if no more words are required */ - boolean addWord(char[] word, int wordOffset, int wordLength, int frequency); + boolean addWord(char[] word, int wordOffset, int wordLength, int frequency, int dicTypeId, + DataType dataType); } /** @@ -65,6 +71,21 @@ abstract public class Dictionary { int[] nextLettersFrequencies); /** + * Searches for pairs in the bigram dictionary that matches the previous word and all the + * possible words following are added through the callback object. + * @param composer the key sequence to match + * @param callback the callback object to send possible word following previous word + * @param nextLettersFrequencies array of frequencies of next letters that could follow the + * word so far. For instance, "bracke" can be followed by "t", so array['t'] will have + * a non-zero value on returning from this method. + * Pass in null if you don't want the dictionary to look up next letters. + */ + public void getBigrams(final WordComposer composer, final CharSequence previousWord, + final WordCallback callback, int[] nextLettersFrequencies) { + // empty base implementation + } + + /** * Checks if the given word occurs in the dictionary * @param word the word to search for. The search should be case-insensitive. * @return true if the word exists, false otherwise |