java.lang.Object
org.miaixz.bus.extra.nlp.provider.analysis.AnalysisProvider
- All Implemented Interfaces:
Serializable,org.miaixz.bus.core.Provider,NLPProvider
- Direct Known Subclasses:
SmartcnProvider
Abstract provider for Lucene-analysis based word segmentation engines. This class provides a base implementation for
integrating various Lucene analyzers. Project homepage: https://github.com/apache/lucene-solr/tree/master/lucene/analysis
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAnalysisProvider(org.apache.lucene.analysis.Analyzer analyzer) Constructs a newAnalysisProviderinstance with a specified LuceneAnalyzer. -
Method Summary
Modifier and TypeMethodDescriptionparse(CharSequence text) Performs word segmentation on the given text using the configured LuceneAnalyzer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.extra.nlp.NLPProvider
type
-
Constructor Details
-
AnalysisProvider
public AnalysisProvider(org.apache.lucene.analysis.Analyzer analyzer) Constructs a newAnalysisProviderinstance with a specified LuceneAnalyzer.- Parameters:
analyzer- TheAnalyzerto use for word segmentation.
-
-
Method Details
-
parse
Performs word segmentation on the given text using the configured LuceneAnalyzer. It creates aTokenStreamfrom the text and wraps it in anAnalysisResult.- Specified by:
parsein interfaceNLPProvider- Parameters:
text- The input textCharSequenceto be segmented.- Returns:
- An
NLPResultobject containing the segmented words from the Lucene analyzer. - Throws:
org.miaixz.bus.core.lang.exception.InternalException- if anIOExceptionoccurs during token stream processing.
-