org.apache.lucene.analysis.cn.smart
public class SmartChineseAnalyzer extends org.apache.lucene.analysis.Analyzer
SmartChineseAnalyzer is an analyzer for Chinese or mixed Chinese-English text. The analyzer uses probabilistic knowledge to find the optimal word segmentation for Simplified Chinese text. The text is first broken into sentences, then each sentence is segmented into words.
Segmentation is based upon the Hidden Markov Model. A large training corpus was used to calculate Chinese word frequency probability.
This analyzer requires a dictionary to provide statistical data. SmartChineseAnalyzer has an included dictionary out-of-box.
The included dictionary data is from ICTCLAS1.0. Thanks to ICTCLAS for their hard work, and for contributing the data under the Apache 2 License!
WARNING: The status of the analyzers/smartcn analysis.cn.smart package is experimental. The APIs and file formats introduced here might change in the future and will not be supported anymore in such a case.
Constructor and Description |
---|
SmartChineseAnalyzer()
Deprecated.
Use
SmartChineseAnalyzer(Version) instead |
SmartChineseAnalyzer(boolean useDefaultStopWords)
Deprecated.
Use
SmartChineseAnalyzer(Version, boolean) instead |
SmartChineseAnalyzer(java.util.Set stopWords)
Deprecated.
Use
SmartChineseAnalyzer(Version, Set) instead |
SmartChineseAnalyzer(org.apache.lucene.util.Version matchVersion)
Create a new SmartChineseAnalyzer, using the default stopword list.
|
SmartChineseAnalyzer(org.apache.lucene.util.Version matchVersion,
boolean useDefaultStopWords)
Create a new SmartChineseAnalyzer, optionally using the default stopword list.
|
SmartChineseAnalyzer(org.apache.lucene.util.Version matchVersion,
java.util.Set stopWords)
Create a new SmartChineseAnalyzer, using the provided
Set of stopwords. |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.analysis.TokenStream |
reusableTokenStream(java.lang.String fieldName,
java.io.Reader reader) |
org.apache.lucene.analysis.TokenStream |
tokenStream(java.lang.String fieldName,
java.io.Reader reader) |
public SmartChineseAnalyzer()
SmartChineseAnalyzer(Version)
insteadpublic SmartChineseAnalyzer(org.apache.lucene.util.Version matchVersion)
public SmartChineseAnalyzer(boolean useDefaultStopWords)
SmartChineseAnalyzer(Version, boolean)
insteadCreate a new SmartChineseAnalyzer, optionally using the default stopword list.
The included default stopword list is simply a list of punctuation. If you do not use this list, punctuation will not be removed from the text!
useDefaultStopWords
- true to use the default stopword list.public SmartChineseAnalyzer(org.apache.lucene.util.Version matchVersion, boolean useDefaultStopWords)
Create a new SmartChineseAnalyzer, optionally using the default stopword list.
The included default stopword list is simply a list of punctuation. If you do not use this list, punctuation will not be removed from the text!
useDefaultStopWords
- true to use the default stopword list.public SmartChineseAnalyzer(java.util.Set stopWords)
SmartChineseAnalyzer(Version, Set)
instead
Create a new SmartChineseAnalyzer, using the provided Set
of stopwords.
Note: the set should include punctuation, unless you want to index punctuation!
stopWords
- Set
of stopwords to use.public SmartChineseAnalyzer(org.apache.lucene.util.Version matchVersion, java.util.Set stopWords)
Create a new SmartChineseAnalyzer, using the provided Set
of stopwords.
Note: the set should include punctuation, unless you want to index punctuation!
stopWords
- Set
of stopwords to use.public org.apache.lucene.analysis.TokenStream tokenStream(java.lang.String fieldName, java.io.Reader reader)
tokenStream
in class org.apache.lucene.analysis.Analyzer
public org.apache.lucene.analysis.TokenStream reusableTokenStream(java.lang.String fieldName, java.io.Reader reader) throws java.io.IOException
reusableTokenStream
in class org.apache.lucene.analysis.Analyzer
java.io.IOException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.