PTDictionarypublic interface PTDictionary Interface for predictive text processing
This class is responsible for initializing the Dictionary
Two APIs are required,
addWord : An interface to add a word to current dictionary (if supported)
iterator: Get a iterator object with the following methods
iterator.next() : get next possible completion string
iterator.hasNext() : check if another possible completion exists
iterator.nextLevel(int key) : add a char to the current completion
iterator.provLevel() : backspace last char from current completion
iterator.reset() : clear current completion
iteratr.resetNext() : revert to first possible completion string
Example of using the predictive text API:
PTDictionary dictionary;
PTIterator iter=dictionary.iterator();
iter.nextLevel('2');
iter.nextLevel('2');
iter.nextLevel('2');
while(iter.hasNext()) {
String completion=iter.next();
System.out.println(completion);
//will print "aca" (short of "academy") "cab" (short of "cabin"),
// "acc" (short of "accelerate") etc.
} |
|