FileDocCategorySizeDatePackage
TestPlainTextDictionary.javaAPI DocApache Lucene 2.2.01703Sat Jun 16 22:21:02 BST 2007org.apache.lucene.search.spell

TestPlainTextDictionary

public class TestPlainTextDictionary extends TestCase
Test case for PlainTextDictionary
author
Daniel Naber

Fields Summary
Constructors Summary
Methods Summary
public voidtestBuild()

    final String LF = System.getProperty("line.separator");
    String input = "oneword" + LF + "twoword" + LF + "threeword";
    PlainTextDictionary ptd = new PlainTextDictionary(new StringReader(input));
    RAMDirectory ramDir = new RAMDirectory();
    SpellChecker spellChecker = new SpellChecker(ramDir);
    spellChecker.indexDictionary(ptd);
    String[] similar = spellChecker.suggestSimilar("treeword", 2);
    assertEquals(2, similar.length);
    assertEquals(similar[0], "threeword");
    assertEquals(similar[1], "twoword");