public final class StopAnalyzer extends StopwordAnalyzerBase
Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents
stopwords
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY
Constructor and Description |
---|
StopAnalyzer(CharArraySet stopWords)
Builds an analyzer with the stop words from the given set.
|
StopAnalyzer(java.nio.file.Path stopwordsFile)
Builds an analyzer with the stop words from the given path.
|
StopAnalyzer(java.io.Reader stopwords)
Builds an analyzer with the stop words from the given reader.
|
Modifier and Type | Method and Description |
---|---|
protected Analyzer.TokenStreamComponents |
createComponents(java.lang.String fieldName)
Creates
Analyzer.TokenStreamComponents
used to tokenize all the text in the provided Reader . |
protected TokenStream |
normalize(java.lang.String fieldName,
TokenStream in)
Wrap the given
TokenStream in order to apply normalization filters. |
getStopwordSet, loadStopwordSet, loadStopwordSet, loadStopwordSet
attributeFactory, close, getOffsetGap, getPositionIncrementGap, getReuseStrategy, getVersion, initReader, initReaderForNormalization, normalize, setVersion, tokenStream, tokenStream
public StopAnalyzer(CharArraySet stopWords)
stopWords
- Set of stop wordspublic StopAnalyzer(java.nio.file.Path stopwordsFile) throws java.io.IOException
stopwordsFile
- File to load stop words fromjava.io.IOException
WordlistLoader.getWordSet(Reader)
public StopAnalyzer(java.io.Reader stopwords) throws java.io.IOException
stopwords
- Reader to load stop words fromjava.io.IOException
WordlistLoader.getWordSet(Reader)
protected Analyzer.TokenStreamComponents createComponents(java.lang.String fieldName)
Analyzer.TokenStreamComponents
used to tokenize all the text in the provided Reader
.createComponents
in class Analyzer
fieldName
- the name of the fields content passed to the
Analyzer.TokenStreamComponents
sink as a readerAnalyzer.TokenStreamComponents
built from a LetterTokenizer
filtered with
StopFilter
protected TokenStream normalize(java.lang.String fieldName, TokenStream in)
Analyzer
TokenStream
in order to apply normalization filters.
The default implementation returns the TokenStream
as-is. This is
used by Analyzer.normalize(String, String)
.