Module bus.extra

Class MmsegResult

java.lang.Object
org.miaixz.bus.core.center.iterator.ComputeIterator<NLPWord>
org.miaixz.bus.extra.nlp.AbstractResult
org.miaixz.bus.extra.nlp.provider.mmseg.MmsegResult
All Implemented Interfaces:
Iterable<NLPWord>, Iterator<NLPWord>, org.miaixz.bus.core.center.iterator.IterableIterator<NLPWord>, NLPResult

public class MmsegResult extends AbstractResult
mmseg4j word segmentation result implementation. This class adapts the mmseg4j MMSeg result to the common NLPResult interface. Project homepage: https://github.com/chenlb/mmseg4j-core
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • MmsegResult

      public MmsegResult(com.chenlb.mmseg4j.MMSeg mmSeg)
      Constructs a MmsegResult instance by wrapping an mmseg4j segmentation result.
      Parameters:
      mmSeg - The MMSeg object obtained from mmseg4j word segmentation.
  • Method Details

    • nextWord

      protected NLPWord nextWord()
      Retrieves the next word from the mmseg4j segmentation result. This method calls the next() method of the underlying MMSeg and wraps the resulting Word in a MmsegWord.
      Specified by:
      nextWord in class AbstractResult
      Returns:
      The next NLPWord in the sequence, or null if the iteration has no more elements.
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - if an IOException occurs during the operation.