Package org.apache.lucene.analysis.ja
Class JapaneseAnalyzer
- java.lang.Object
-
- org.apache.lucene.analysis.Analyzer
-
- org.apache.lucene.analysis.StopwordAnalyzerBase
-
- org.apache.lucene.analysis.ja.JapaneseAnalyzer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class JapaneseAnalyzer extends StopwordAnalyzerBase
Analyzer for Japanese that uses morphological analysis.- Since:
- 3.6.0
- See Also:
JapaneseTokenizer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JapaneseAnalyzer.DefaultSetHolder
Atomically loads DEFAULT_STOP_SET, DEFAULT_STOP_TAGS in a lazy fashion once the outer class accesses the static final set the first time.-
Nested classes/interfaces inherited from class org.apache.lucene.analysis.Analyzer
Analyzer.ReuseStrategy, Analyzer.TokenStreamComponents
-
-
Field Summary
Fields Modifier and Type Field Description private JapaneseTokenizer.Mode
mode
private java.util.Set<java.lang.String>
stoptags
private UserDictionary
userDict
-
Fields inherited from class org.apache.lucene.analysis.StopwordAnalyzerBase
stopwords
-
Fields inherited from class org.apache.lucene.analysis.Analyzer
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description JapaneseAnalyzer()
JapaneseAnalyzer(UserDictionary userDict, JapaneseTokenizer.Mode mode, CharArraySet stopwords, java.util.Set<java.lang.String> stoptags)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Analyzer.TokenStreamComponents
createComponents(java.lang.String fieldName)
Creates a newAnalyzer.TokenStreamComponents
instance for this analyzer.static CharArraySet
getDefaultStopSet()
static java.util.Set<java.lang.String>
getDefaultStopTags()
protected TokenStream
normalize(java.lang.String fieldName, TokenStream in)
Wrap the givenTokenStream
in order to apply normalization filters.-
Methods inherited from class org.apache.lucene.analysis.StopwordAnalyzerBase
getStopwordSet, loadStopwordSet, loadStopwordSet, loadStopwordSet
-
Methods inherited from class org.apache.lucene.analysis.Analyzer
attributeFactory, close, getOffsetGap, getPositionIncrementGap, getReuseStrategy, getVersion, initReader, initReaderForNormalization, normalize, setVersion, tokenStream, tokenStream
-
-
-
-
Field Detail
-
mode
private final JapaneseTokenizer.Mode mode
-
stoptags
private final java.util.Set<java.lang.String> stoptags
-
userDict
private final UserDictionary userDict
-
-
Constructor Detail
-
JapaneseAnalyzer
public JapaneseAnalyzer()
-
JapaneseAnalyzer
public JapaneseAnalyzer(UserDictionary userDict, JapaneseTokenizer.Mode mode, CharArraySet stopwords, java.util.Set<java.lang.String> stoptags)
-
-
Method Detail
-
getDefaultStopSet
public static CharArraySet getDefaultStopSet()
-
getDefaultStopTags
public static java.util.Set<java.lang.String> getDefaultStopTags()
-
createComponents
protected Analyzer.TokenStreamComponents createComponents(java.lang.String fieldName)
Description copied from class:Analyzer
Creates a newAnalyzer.TokenStreamComponents
instance for this analyzer.- Specified by:
createComponents
in classAnalyzer
- Parameters:
fieldName
- the name of the fields content passed to theAnalyzer.TokenStreamComponents
sink as a reader- Returns:
- the
Analyzer.TokenStreamComponents
for this analyzer.
-
normalize
protected TokenStream normalize(java.lang.String fieldName, TokenStream in)
Description copied from class:Analyzer
Wrap the givenTokenStream
in order to apply normalization filters. The default implementation returns theTokenStream
as-is. This is used byAnalyzer.normalize(String, String)
.
-
-