public final class PersianAnalyzer extends StopwordAnalyzerBase
Analyzer
for Persian.
This Analyzer uses PersianCharFilter
which implies tokenizing around
zero-width non-joiner in addition to whitespace. Some persian-specific variant forms (such as farsi
yeh and keheh) are standardized. "Stemming" is accomplished via stopwords.
Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_STOPWORD_FILE
File containing default Persian stopwords.
|
static String |
STOPWORDS_COMMENT
The comment character in the stopwords file.
|
stopwords
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY
Constructor and Description |
---|
PersianAnalyzer()
Builds an analyzer with the default stop words:
DEFAULT_STOPWORD_FILE . |
PersianAnalyzer(CharArraySet stopwords)
Builds an analyzer with the given stop words
|
Modifier and Type | Method and Description |
---|---|
protected Analyzer.TokenStreamComponents |
createComponents(String fieldName)
Creates
Analyzer.TokenStreamComponents
used to tokenize all the text in the provided Reader . |
static CharArraySet |
getDefaultStopSet()
Returns an unmodifiable instance of the default stop-words set.
|
protected Reader |
initReader(String fieldName,
Reader reader)
Wraps the Reader with
PersianCharFilter |
protected TokenStream |
normalize(String fieldName,
TokenStream in) |
getStopwordSet, loadStopwordSet, loadStopwordSet, loadStopwordSet
attributeFactory, close, getOffsetGap, getPositionIncrementGap, getReuseStrategy, getVersion, initReaderForNormalization, normalize, setVersion, tokenStream, tokenStream
public static final String DEFAULT_STOPWORD_FILE
public static final String STOPWORDS_COMMENT
public PersianAnalyzer()
DEFAULT_STOPWORD_FILE
.public PersianAnalyzer(CharArraySet stopwords)
stopwords
- a stopword setpublic static CharArraySet getDefaultStopSet()
protected Analyzer.TokenStreamComponents createComponents(String fieldName)
Analyzer.TokenStreamComponents
used to tokenize all the text in the provided Reader
.createComponents
in class Analyzer
Analyzer.TokenStreamComponents
built from a StandardTokenizer
filtered with
LowerCaseFilter
, DecimalDigitFilter
, ArabicNormalizationFilter
,
PersianNormalizationFilter
and Persian Stop wordsprotected TokenStream normalize(String fieldName, TokenStream in)
protected Reader initReader(String fieldName, Reader reader)
PersianCharFilter
initReader
in class Analyzer
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.