org.apache.lucene.spelt
Class SpellWritingAnalyzer

Object
  extended by Analyzer
      extended by SpellWritingAnalyzer

public class SpellWritingAnalyzer
extends Analyzer

Drop-in replacement for the Lucene StandardAnalyzer, which performs all the same functions plus queues words to a spelling dictionary.

Author:
Martin Haye

Field Summary
static String[] STOP_WORDS
          An array containing some common English words that are usually not useful for searching.
private  Set stopSet
          Set of stop words to remove during analysis
private  SpellWriter writer
          Destination for words to be added to dictionary
 
Constructor Summary
SpellWritingAnalyzer(File stopwords, SpellWriter spellWriter)
          Builds an analyzer which writes to the given spelling dictionary, using the stop words from the given file.
SpellWritingAnalyzer(Reader stopwords, SpellWriter spellWriter)
          Builds an analyzer which writes to the given spelling dictionary, using the stop words from the given reader.
SpellWritingAnalyzer(Set stopWords, SpellWriter spellWriter)
          Builds an analyzer which writes to the given spelling dictionary, using the given stop words.
SpellWritingAnalyzer(SpellWriter spellWriter)
          Builds an analyzer which writes to the given spelling dictionary, with the default stop words (STOP_WORDS).
SpellWritingAnalyzer(String[] stopWords, SpellWriter spellWriter)
          Builds an analyzer which writes to the given spelling dictionary, using the given stop words.
 
Method Summary
 TokenStream tokenStream(String fieldName, Reader reader)
          Constructs a StandardTokenizer filtered by a StandardFilter, a SpellWritingFilter, a LowerCaseFilter and a StopFilter.
 
Methods inherited from class Analyzer
getPositionIncrementGap
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stopSet

private Set stopSet
Set of stop words to remove during analysis


writer

private SpellWriter writer
Destination for words to be added to dictionary


STOP_WORDS

public static final String[] STOP_WORDS
An array containing some common English words that are usually not useful for searching.

Constructor Detail

SpellWritingAnalyzer

public SpellWritingAnalyzer(SpellWriter spellWriter)
Builds an analyzer which writes to the given spelling dictionary, with the default stop words (STOP_WORDS).


SpellWritingAnalyzer

public SpellWritingAnalyzer(Set stopWords,
                            SpellWriter spellWriter)
Builds an analyzer which writes to the given spelling dictionary, using the given stop words.


SpellWritingAnalyzer

public SpellWritingAnalyzer(String[] stopWords,
                            SpellWriter spellWriter)
Builds an analyzer which writes to the given spelling dictionary, using the given stop words.


SpellWritingAnalyzer

public SpellWritingAnalyzer(File stopwords,
                            SpellWriter spellWriter)
                     throws IOException
Builds an analyzer which writes to the given spelling dictionary, using the stop words from the given file.

Throws:
IOException
See Also:
WordlistLoader.getWordSet(File)

SpellWritingAnalyzer

public SpellWritingAnalyzer(Reader stopwords,
                            SpellWriter spellWriter)
                     throws IOException
Builds an analyzer which writes to the given spelling dictionary, using the stop words from the given reader.

Throws:
IOException
See Also:
WordlistLoader.getWordSet(Reader)
Method Detail

tokenStream

public TokenStream tokenStream(String fieldName,
                               Reader reader)
Constructs a StandardTokenizer filtered by a StandardFilter, a SpellWritingFilter, a LowerCaseFilter and a StopFilter.

Specified by:
tokenStream in class Analyzer