public abstract class StopwordAnalyzerBase extends Analyzer
Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents| Modifier and Type | Field and Description |
|---|---|
protected CharArraySet |
stopwords
An immutable stopword set
|
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY| Modifier | Constructor and Description |
|---|---|
protected |
StopwordAnalyzerBase()
Creates a new Analyzer with an empty stopword set
|
protected |
StopwordAnalyzerBase(CharArraySet stopwords)
Creates a new instance initialized with the given stopword set
|
| Modifier and Type | Method and Description |
|---|---|
CharArraySet |
getStopwordSet()
Returns the analyzer's stopword set or an empty set if the analyzer has no
stopwords
|
protected static CharArraySet |
loadStopwordSet(boolean ignoreCase,
Class<? extends Analyzer> aClass,
String resource,
String comment)
Creates a CharArraySet from a file resource associated with a class.
|
protected static CharArraySet |
loadStopwordSet(Path stopwords)
Creates a CharArraySet from a path.
|
protected static CharArraySet |
loadStopwordSet(Reader stopwords)
Creates a CharArraySet from a file.
|
close, createComponents, getOffsetGap, getPositionIncrementGap, getReuseStrategy, getVersion, initReader, setVersion, tokenStream, tokenStreamprotected final CharArraySet stopwords
protected StopwordAnalyzerBase(CharArraySet stopwords)
stopwords - the analyzer's stopword setprotected StopwordAnalyzerBase()
public CharArraySet getStopwordSet()
protected static CharArraySet loadStopwordSet(boolean ignoreCase, Class<? extends Analyzer> aClass, String resource, String comment) throws IOException
Class.getResourceAsStream(String)).ignoreCase - true if the set should ignore the case of the
stopwords, otherwise falseaClass - a class that is associated with the given stopwordResourceresource - name of the resource file associated with the given classcomment - comment string to ignore in the stopword fileIOException - if loading the stopwords throws an IOExceptionprotected static CharArraySet loadStopwordSet(Path stopwords) throws IOException
stopwords - the stopwords file to loadIOException - if loading the stopwords throws an IOExceptionprotected static CharArraySet loadStopwordSet(Reader stopwords) throws IOException
stopwords - the stopwords reader to loadIOException - if loading the stopwords throws an IOExceptionCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.