Package opennlp.tools.util.normalizer
Class NfkcCharSequenceNormalizer
java.lang.Object
opennlp.tools.util.normalizer.NfkcCharSequenceNormalizer
- All Implemented Interfaces:
Serializable,CharSequenceNormalizer
A
CharSequenceNormalizer that applies Unicode Normalization Form KC (compatibility
composition, UAX #15).
NFKC folds compatibility variants to their canonical form: fullwidth and halfwidth letters,
the U+FB01 ligature to fi, and super/subscript digits to plain digits. It is
more aggressive than NFC and is lossy (it can change a
character's appearance or meaning, e.g. a squared numeral to a plain one), so it is a deliberate
choice for search/recall rather than a safe default.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final NfkcCharSequenceNormalizerprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NfkcCharSequenceNormalizerReturns the shared, stateless instance.normalize(CharSequence text) Normalizes a sequence of characters.private ObjectReturns the shared instance, so deserialization keeps the singleton.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
INSTANCE
-
-
Constructor Details
-
NfkcCharSequenceNormalizer
public NfkcCharSequenceNormalizer()
-
-
Method Details
-
getInstance
Returns the shared, stateless instance.- Returns:
- the shared, stateless instance
-
normalize
Normalizes a sequence of characters.- Specified by:
normalizein interfaceCharSequenceNormalizer- Parameters:
text- TheCharSequenceto normalize. Must not benull.- Returns:
- The normalized
CharSequence.
-
readResolve
Returns the shared instance, so deserialization keeps the singleton.- Returns:
- the shared instance, so deserialization keeps the singleton
-