Package opennlp.tools.util.normalizer
Class TextNormalizer
java.lang.Object
opennlp.tools.util.normalizer.TextNormalizer
Entry point for composing normalization steps into a single
CharSequenceNormalizer.
Use builder() to assemble a chain, or defaultChain() for a conservative,
ready-made chain. Steps run in the order they are added. Each step is a shared, stateless
normalizer; the built result is an AggregateCharSequenceNormalizer that applies them
in sequence.
CharSequenceNormalizer n = TextNormalizer.builder()
.nfc().caseFold().accentFold()
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder that appends normalization steps in order and composes them into oneCharSequenceNormalizerviaTextNormalizer.Builder.build(). -
Method Summary
Modifier and TypeMethodDescriptionstatic TextNormalizer.Builderbuilder()Returns a new, emptyTextNormalizer.Builder.static opennlp.tools.util.normalizer.CharSequenceNormalizerReturns a conservative, ready-made normalization chain.
-
Method Details
-
builder
Returns a new, emptyTextNormalizer.Builder.- Returns:
- a new, empty
TextNormalizer.Builder
-
defaultChain
public static opennlp.tools.util.normalizer.CharSequenceNormalizer defaultChain()Returns a conservative, ready-made normalization chain.The chain strips invisible controls, applies NFC, collapses whitespace, folds quotes and dashes, case folds, and finally applies script-gated diacritic folding.
- Returns:
- a conservative, ready-made normalization chain
-