java.lang.Object
org.miaixz.bus.extra.nlp.NLPKit
Utility class for Natural Language Processing (NLP) word segmentation. This class provides a facade for accessing
various NLP segmentation engines, allowing for easy text parsing and word extraction.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NLPProvidercreateEngine(String engineName) Creates a word segmentation engine object with the specified engine name.static NLPProviderAutomatically creates and retrieves the corresponding word segmentation engine object.static NLPResultPerforms word segmentation on the given text using the default NLP engine.
-
Constructor Details
-
NLPKit
public NLPKit()
-
-
Method Details
-
parse
Performs word segmentation on the given text using the default NLP engine. -
getEngine
Automatically creates and retrieves the corresponding word segmentation engine object. The engine is determined based on the NLP engine JARs introduced by the user via SPI mechanism.- Returns:
- An
NLPProviderinstance, representing the chosen NLP segmentation engine.
-
createEngine
Creates a word segmentation engine object with the specified engine name. This allows for explicit selection of an NLP provider when multiple are available.- Parameters:
engineName- The name of the NLP engine to create (e.g., "Ansj", "HanLP").- Returns:
- An
NLPProviderinstance corresponding to the given engine name.
-