org.apache.lucene.spelt
Class SpellTestCmdLine

Object
  extended by SpellTestCmdLine

public class SpellTestCmdLine
extends Object

A command-line driver class to test out the spelling correction engine.

Author:
Martin Haye

Nested Class Summary
private static class SpellTestCmdLine.DictBuilder
          Common interface for various dictionary-building algorithms
private static class SpellTestCmdLine.SpeltDictBuilder
          Builds a new-style Spelt spelling dictionary
private static class SpellTestCmdLine.SpeltSuggTester
          Get spelling suggestions using the Spelt (new) algorithm
private static interface SpellTestCmdLine.SuggTester
          Generic strategy for testing spelling suggestion algorithms
private static class SpellTestCmdLine.TextRipper
          Scans a directory for files, and rips text from all of them.
 
Constructor Summary
SpellTestCmdLine()
           
 
Method Summary
private static void buildDictionary(int alg, String srcDir, String dictDir)
          Rip text from files in a given source directory and add them to a spelling dictionary, using the specified algorithm.
static void main(String[] args)
          Parse command line arguments and run.
private static HashSet makeStopSet()
          Create a default stop-word set
private static void printUsageAndExit()
          Prints out a message saying how to use this tool, then exits.
private static void testDictionary(int alg, String testFile, String dictDir)
          Test the spelling index
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpellTestCmdLine

public SpellTestCmdLine()
Method Detail

main

public static void main(String[] args)
Parse command line arguments and run.


printUsageAndExit

private static void printUsageAndExit()
Prints out a message saying how to use this tool, then exits.


buildDictionary

private static void buildDictionary(int alg,
                                    String srcDir,
                                    String dictDir)
                             throws IOException
Rip text from files in a given source directory and add them to a spelling dictionary, using the specified algorithm.

Parameters:
alg - 0 for null (to test speed of ripper); 1 for the old Lucene algorithm; 2 for the new Spelt algorithm.
srcDir - Directory to grab files to rip
dictDir - Directory to put spelling dictionary in
Throws:
IOException

testDictionary

private static void testDictionary(int alg,
                                   String testFile,
                                   String dictDir)
                            throws IOException
Test the spelling index

Throws:
IOException

makeStopSet

private static HashSet makeStopSet()
Create a default stop-word set