Package opennlp.tools.util.normalizer
Class GermanUmlautCharSequenceNormalizer
java.lang.Object
opennlp.tools.util.normalizer.GermanUmlautCharSequenceNormalizer
- All Implemented Interfaces:
Serializable,CharSequenceNormalizer,OffsetAwareNormalizer
A
CharSequenceNormalizer that transliterates German umlauts and the eszett the way German
conventionally expands them (DIN 5007-2): a-umlaut to ae, o-umlaut to oe,
u-umlaut to ue, and eszett to ss, with the capital umlauts and the capital eszett
(U+1E9E) expanded likewise.
This is the correct diacritic fold for German, where the generic
AccentFoldCharSequenceNormalizer (which would yield a, o, u) is
wrong. It is an expanding, offset-changing transform, so like the other folds it belongs to the
derived matching form rather than to anything offset-preserving.
The fold matches the precomposed code points. A base letter followed by a combining diaeresis
(for example a + U+0308) is not a member and passes through unchanged, so apply NFC
composition first if the input may contain decomposed forms.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final GermanUmlautCharSequenceNormalizerprivate static final longprivate static final intprivate static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Stringexpansion(int codePoint) Returns the shared, stateless instance.normalize(CharSequence text) Normalizes a sequence of characters.normalizeAligned(CharSequence text) Normalizestextand returns the result together with theAlignmentback to the input.private ObjectReturns the shared instance, so deserialization keeps the singleton.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
SMALL_A_UMLAUT
private static final int SMALL_A_UMLAUT- See Also:
-
SMALL_O_UMLAUT
private static final int SMALL_O_UMLAUT- See Also:
-
SMALL_U_UMLAUT
private static final int SMALL_U_UMLAUT- See Also:
-
CAPITAL_A_UMLAUT
private static final int CAPITAL_A_UMLAUT- See Also:
-
CAPITAL_O_UMLAUT
private static final int CAPITAL_O_UMLAUT- See Also:
-
CAPITAL_U_UMLAUT
private static final int CAPITAL_U_UMLAUT- See Also:
-
ESZETT
private static final int ESZETT- See Also:
-
CAPITAL_ESZETT
private static final int CAPITAL_ESZETT- See Also:
-
INSTANCE
-
-
Constructor Details
-
GermanUmlautCharSequenceNormalizer
private GermanUmlautCharSequenceNormalizer()
-
-
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.
-
normalizeAligned
Normalizestextand returns the result together with theAlignmentback to the input. The normalized text is identical toCharSequenceNormalizer.normalize(CharSequence): that is,normalizeAligned(text).normalized()equalsnormalize(text).toString().- Specified by:
normalizeAlignedin interfaceOffsetAwareNormalizer- Parameters:
text- TheCharSequenceto normalize.- Returns:
- The normalized text paired with its alignment to
text.
-
expansion
-
readResolve
Returns the shared instance, so deserialization keeps the singleton.- Returns:
- the shared instance, so deserialization keeps the singleton
-