/* * Created on Mar 30, 2005 */ package SimpleSpeller; import java.util.List; /** A class which determines whether words are spelled correctly. * * Concrete implementations should have a public constructor which takes an * array of words (Strings) as its only argument, e.g., * public MySpellChecker(String[] dictionaryWords) {...} * The strings in the array should be non-null and non-empty after * normalization. The normalized forms of the words are considered * to be all and only the correct-spelled words in existence. */ public interface ISpellChecker { /** Convert a string to a normal form, in which any leading and trailing * spaces are stripped out, and any uppercase letters are converted * to lowercase; everything else in the string is unchanged. * @param originalWord any non-null string * @return a normalized string (which may be empty); a null string is * returned if the original string was null. */ String normalize(String originalWord); /** Determine if a word (normalized) matches some (normalized) word * in the dictionary. * @param word a string, which may be empty but not null. * @return true iff the word (normalized) is an exact match * to some word in the dictionary. */ boolean isCorrectlySpelled(String word); }