org.apache.lucene.analysis
Class StopwordAnalyzerBase
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.ReusableAnalyzerBase
org.apache.lucene.analysis.StopwordAnalyzerBase
- All Implemented Interfaces:
- Closeable
- Direct Known Subclasses:
- ArabicAnalyzer, ArmenianAnalyzer, BasqueAnalyzer, BrazilianAnalyzer, BulgarianAnalyzer, CatalanAnalyzer, CJKAnalyzer, ClassicAnalyzer, DanishAnalyzer, EnglishAnalyzer, FinnishAnalyzer, FrenchAnalyzer, GalicianAnalyzer, GermanAnalyzer, GreekAnalyzer, HindiAnalyzer, HungarianAnalyzer, IndonesianAnalyzer, ItalianAnalyzer, NorwegianAnalyzer, PersianAnalyzer, PolishAnalyzer, PortugueseAnalyzer, RomanianAnalyzer, RussianAnalyzer, SpanishAnalyzer, StandardAnalyzer, StopAnalyzer, SwedishAnalyzer, TurkishAnalyzer
public abstract class StopwordAnalyzerBase
- extends ReusableAnalyzerBase
Base class for Analyzers that need to make use of stopword sets.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stopwords
protected final CharArraySet stopwords
- An immutable stopword set
matchVersion
protected final Version matchVersion
StopwordAnalyzerBase
protected StopwordAnalyzerBase(Version version,
Set<?> stopwords)
- Creates a new instance initialized with the given stopword set
- Parameters:
version - the Lucene version for cross version compatibilitystopwords - the analyzer's stopword set
StopwordAnalyzerBase
protected StopwordAnalyzerBase(Version version)
- Creates a new Analyzer with an empty stopword set
- Parameters:
version - the Lucene version for cross version compatibility
getStopwordSet
public Set<?> getStopwordSet()
- Returns the analyzer's stopword set or an empty set if the analyzer has no
stopwords
- Returns:
- the analyzer's stopword set or an empty set if the analyzer has no
stopwords
loadStopwordSet
protected static CharArraySet loadStopwordSet(boolean ignoreCase,
Class<? extends ReusableAnalyzerBase> aClass,
String resource,
String comment)
throws IOException
- Creates a CharArraySet from a file resource associated with a class. (See
Class.getResourceAsStream(String)).
- Parameters:
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 file
- Returns:
- a CharArraySet containing the distinct stopwords from the given
file
- Throws:
IOException - if loading the stopwords throws an IOException
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.