org.apache.lucene.spelt
Class SpellWritingFilter

Object
  extended by TokenStream
      extended by TokenFilter
          extended by SpellWritingFilter

public class SpellWritingFilter
extends TokenFilter

A simple token filter for Lucene, that adds words to a spelling correction dictionary as they're being indexed by Lucene. Generally this should be placed early in the chain of token filters, generally before any non-case modifications (such as thesaurus expansion, stemming, plural/singular conversion, etc.). This way, the correction engine will be able to suggest words that resemble what the user typed in.

Author:
Martin Haye

Field Summary
private  SpellWriter spellWriter
          Queues words for addition to a spelling correction dictionary
 
Fields inherited from class TokenFilter
input
 
Constructor Summary
SpellWritingFilter(TokenStream input, SpellWriter spellWriter)
          Construct a new filter which writes words to a spelling dictionary, but doesn't change any tokens.
 
Method Summary
 Token next()
          Get the next token in the stream.
 
Methods inherited from class TokenFilter
close
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spellWriter

private SpellWriter spellWriter
Queues words for addition to a spelling correction dictionary

Constructor Detail

SpellWritingFilter

public SpellWritingFilter(TokenStream input,
                          SpellWriter spellWriter)
Construct a new filter which writes words to a spelling dictionary, but doesn't change any tokens.

Parameters:
input - stream to read tokens from
spellWriter - destination for spelling words
Method Detail

next

public Token next()
           throws IOException
Get the next token in the stream. We simply call the input filter to get the token, queue the word for the spelling dictionary, and return it for further processing by Lucene.

Specified by:
next in class TokenStream
Throws:
IOException