http://jroller.com/page/JamesGoodwill/20041201
weblog Example
'Jazz' up Your Applications with Open Source Java
Satya - Friday, July 15, 2005 1:50:18 PM
Download all the pieces
If you are planning on working with this make sure you download all the pieces. The dictionaries, The binary, and the docs, and the source. Because the examples are in the source distribution. Docs are in the docs distributions. Docs is just an api.
Satya - Friday, July 15, 2005 6:38:28 PM
Sample source code
package com.ai.lucene;
import java.io.File;
import java.io.IOException;
import java.util.List;
import com.swabunga.spell.engine.SpellDictionaryHashMap;
import com.swabunga.spell.event.SpellChecker;
public class EnglishDictionary
{
protected static SpellDictionaryHashMap dictionary = null;
protected static SpellChecker spellChecker = null;
static {
try {
dictionary =
new SpellDictionaryHashMap(new
File(Constants.DICTIONARY_FILE));
}
catch (IOException e)
{
throw new RuntimeException("Could not open dictionaryu",e);
}
spellChecker = new SpellChecker(dictionary);
}
public static List getSuggestions(String word,
int threshold) {
return spellChecker.getSuggestions(word, threshold);
}
public static boolean isAWord(String word)
{
return dictionary.isCorrect(word);
}
public static void main(String args[])
{
boolean b = EnglishDictionary.isAWord("tas");
if (b == true) Log.log("tas is a word");
Log.log("tas is not a word");
}
}
The above code is based on the web log above by James Goodwill