Module bus.extra

Interface NLPProvider

All Superinterfaces:
org.miaixz.bus.core.Provider, Serializable
All Known Implementing Classes:
AnalysisProvider, AnsjProvider, HanLPProvider, JcsegProvider, JiebaProvider, MmsegProvider, MynlpProvider, SmartcnProvider, WordProvider

public interface NLPProvider extends org.miaixz.bus.core.Provider
Interface definition for Natural Language Processing (NLP) word segmentation engines. Users implement this interface to adapt specific word segmentation engines, such as Ansj, HanLP, etc. Since the engine typically uses a singleton pattern, implementations are required to be thread-safe to handle concurrent requests for word segmentation.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    Performs word segmentation on the given text and returns the result.
    default Object
    Returns the type of this NLP provider.
  • Method Details

    • parse

      NLPResult parse(CharSequence text)
      Performs word segmentation on the given text and returns the result. Implementations should process the input text and produce a structured result containing the segmented words.
      Parameters:
      text - The input text CharSequence to be segmented.
      Returns:
      An NLPResult implementation containing the segmented words.
    • type

      default Object type()
      Returns the type of this NLP provider. By default, it returns EnumValue.Povider.NLP.
      Specified by:
      type in interface org.miaixz.bus.core.Provider
      Returns:
      The type of the provider, typically EnumValue.Povider.NLP.