java.lang.Object
org.miaixz.bus.core.center.iterator.ComputeIterator<NLPWord>
org.miaixz.bus.extra.nlp.AbstractResult
org.miaixz.bus.extra.nlp.provider.analysis.AnalysisResult
- All Implemented Interfaces:
Iterable<NLPWord>,Iterator<NLPWord>,org.miaixz.bus.core.center.iterator.IterableIterator<NLPWord>,NLPResult
Abstract result wrapper for Lucene-analysis word segmentation. This class adapts the Lucene
TokenStream to
the common NLPResult interface. Project homepage: https://github.com/apache/lucene-solr/tree/master/lucene/analysis- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionAnalysisResult(org.apache.lucene.analysis.TokenStream stream) Constructs anAnalysisResultinstance by wrapping a LuceneTokenStream. -
Method Summary
Methods inherited from class org.miaixz.bus.extra.nlp.AbstractResult
computeNextMethods inherited from class org.miaixz.bus.core.center.iterator.ComputeIterator
finish, hasNext, nextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.miaixz.bus.core.center.iterator.IterableIterator
iteratorMethods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Constructor Details
-
AnalysisResult
public AnalysisResult(org.apache.lucene.analysis.TokenStream stream) Constructs anAnalysisResultinstance by wrapping a LuceneTokenStream.- Parameters:
stream- TheTokenStreamobtained from Lucene analysis.
-
-
Method Details
-
nextWord
Retrieves the next word from the LuceneTokenStream. This method callsincrementToken()on the stream and wraps the resultingCharTermAttributein anAnalysisWord.- Specified by:
nextWordin classAbstractResult- Returns:
- The next
NLPWordin the sequence, ornullif the iteration has no more elements. - Throws:
org.miaixz.bus.core.lang.exception.InternalException- if anIOExceptionoccurs during token processing.
-