FileDocCategorySizeDatePackage
Dictionary.javaAPI DocAndroid 1.5 API3513Wed May 06 22:42:48 BST 2009com.android.inputmethod.latin

Dictionary

public abstract class Dictionary extends Object
Abstract base class for a dictionary that can do a fuzzy search for words based on a set of key strokes.

Fields Summary
protected static final boolean
INCLUDE_TYPED_WORD_IF_VALID
Whether or not to replicate the typed word in the suggested list, even if it's valid.
protected static final int
FULL_WORD_FREQ_MULTIPLIER
The weight to give to a word if it's length is the same as the number of typed characters.
Constructors Summary
Methods Summary
public abstract voidgetWords(WordComposer composer, com.android.inputmethod.latin.Dictionary$WordCallback callback)
Searches for words in the dictionary that match the characters in the composer. Matched words are added through the callback object.

param
composer the key sequence to match
param
callback the callback object to send matched words to as possible candidates
see
WordCallback#addWord(char[], int, int)

public abstract booleanisValidWord(java.lang.CharSequence word)
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

protected booleansame(char[] word, int length, java.lang.CharSequence typedWord)
Compares the contents of the character array with the typed word and returns true if they are the same.

param
word the array of characters that make up the word
param
length the number of valid characters in the character array
param
typedWord the word to compare with
return
true if they are the same, false otherwise.

    
                          
       
                                                                                                   
                
    

                                                       
            

                                      
        
    
                                                                  
               
        if (typedWord.length() != length) {
            return false;
        }
        for (int i = 0; i < length; i++) {
            if (word[i] != typedWord.charAt(i)) {
                return false;
            }
        }
        return true;