org.apache.lucene.analysis
Class StopFilter

java.lang.Object
  |
  +--org.apache.lucene.analysis.TokenStream
        |
        +--org.apache.lucene.analysis.TokenFilter
              |
              +--org.apache.lucene.analysis.StopFilter

public final class StopFilter
extends TokenFilter

Removes stop words from a token stream.


Fields inherited from class org.apache.lucene.analysis.TokenFilter
input
 
Constructor Summary
StopFilter(TokenStream in, Hashtable stopTable)
          Constructs a filter which removes words from the input TokenStream that are named in the Hashtable.
StopFilter(TokenStream in, String[] stopWords)
          Constructs a filter which removes words from the input TokenStream that are named in the array of words.
 
Method Summary
static Hashtable makeStopTable(String[] stopWords)
          Builds a Hashtable from an array of stop words, appropriate for passing into the StopFilter constructor.
 Token next()
          Returns the next input Token whose termText() is not a stop word.
 
Methods inherited from class org.apache.lucene.analysis.TokenFilter
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StopFilter

public StopFilter(TokenStream in,
                  String[] stopWords)
Constructs a filter which removes words from the input TokenStream that are named in the array of words.

StopFilter

public StopFilter(TokenStream in,
                  Hashtable stopTable)
Constructs a filter which removes words from the input TokenStream that are named in the Hashtable.
Method Detail

makeStopTable

public static final Hashtable makeStopTable(String[] stopWords)
Builds a Hashtable from an array of stop words, appropriate for passing into the StopFilter constructor. This permits this table construction to be cached once when an Analyzer is constructed.

next

public final Token next()
                 throws IOException
Returns the next input Token whose termText() is not a stop word.
Overrides:
next in class TokenStream


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.