Module bus.extra

Class JiebaProvider

java.lang.Object
org.miaixz.bus.extra.nlp.provider.jieba.JiebaProvider
All Implemented Interfaces:
Serializable, org.miaixz.bus.core.Provider, NLPProvider

public class JiebaProvider extends Object implements NLPProvider
Jieba word segmentation engine implementation. This class serves as a concrete NLPProvider for the Jieba NLP library, adapting its word segmentation capabilities to the common NLP interface. The underlying JiebaSegmenter.process(String, SegMode) method is thread-safe. Project homepage: https://github.com/huaban/jieba-analysis
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new JiebaProvider instance with the default segmentation mode, which is JiebaSegmenter.SegMode.SEARCH.
    JiebaProvider(com.huaban.analysis.jieba.JiebaSegmenter.SegMode mode)
    Constructs a new JiebaProvider instance with a specified segmentation mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    Performs word segmentation on the given text using the configured Jieba JiebaSegmenter instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.miaixz.bus.extra.nlp.NLPProvider

    type
  • Constructor Details

    • JiebaProvider

      public JiebaProvider()
      Constructs a new JiebaProvider instance with the default segmentation mode, which is JiebaSegmenter.SegMode.SEARCH.
    • JiebaProvider

      public JiebaProvider(com.huaban.analysis.jieba.JiebaSegmenter.SegMode mode)
      Constructs a new JiebaProvider instance with a specified segmentation mode.
      Parameters:
      mode - The JiebaSegmenter.SegMode to use for word segmentation (e.g., JiebaSegmenter.SegMode.SEARCH or JiebaSegmenter.SegMode.INDEX).
  • Method Details

    • parse

      public NLPResult parse(CharSequence text)
      Performs word segmentation on the given text using the configured Jieba JiebaSegmenter instance. The result is wrapped in a JiebaResult to conform to the NLPResult interface.
      Specified by:
      parse in interface NLPProvider
      Parameters:
      text - The input text CharSequence to be segmented.
      Returns:
      An NLPResult object containing the segmented words from Jieba.