java.lang.Object
org.miaixz.bus.extra.nlp.provider.mynlp.MynlpProvider
- All Implemented Interfaces:
Serializable,org.miaixz.bus.core.Provider,NLPProvider
Mynlp word segmentation engine implementation. This class serves as a concrete
NLPProvider for the Mynlp NLP
library, adapting its word segmentation capabilities to the common NLP interface. The underlying Lexer is
thread-safe. Project homepage: https://github.com/mayabot/mynlp/- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newMynlpProviderinstance with a default Mynlp lexer.MynlpProvider(com.mayabot.nlp.segment.Lexer lexer) Constructs a newMynlpProviderinstance with a custom MynlpLexerimplementation. -
Method Summary
Modifier and TypeMethodDescriptionparse(CharSequence text) Performs word segmentation on the given text using the configured MynlpLexerinstance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.extra.nlp.NLPProvider
type
-
Constructor Details
-
MynlpProvider
public MynlpProvider()Constructs a newMynlpProviderinstance with a default Mynlp lexer. The default lexer is a bigram lexer with part-of-speech tagging and person name recognition enabled. -
MynlpProvider
public MynlpProvider(com.mayabot.nlp.segment.Lexer lexer) Constructs a newMynlpProviderinstance with a custom MynlpLexerimplementation.- Parameters:
lexer- The customLexerobject to use for word segmentation.
-
-
Method Details
-
parse
Performs word segmentation on the given text using the configured MynlpLexerinstance. The result is wrapped in aMynlpResultto conform to theNLPResultinterface.- Specified by:
parsein interfaceNLPProvider- Parameters:
text- The input textCharSequenceto be segmented.- Returns:
- An
NLPResultobject containing the segmented words from Mynlp.
-