Package opennlp.tools.util.normalizer
Class BulletCharSequenceNormalizer
java.lang.Object
opennlp.tools.util.normalizer.BulletCharSequenceNormalizer
- All Implemented Interfaces:
Serializable,CharSequenceNormalizer,OffsetAwareNormalizer
A
CharSequenceNormalizer that replaces unambiguous list-bullet characters with a space,
so a bullet acts as a token separator rather than sticking to the following word.
Membership is an O(1) CharClass lookup. The middle dot (U+00B7) is
deliberately not included, because it is a letter in Catalan (l..l) and other
orthographies; only characters that are unambiguously list bullets are replaced.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final CharClassprivate static final BulletCharSequenceNormalizerprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BulletCharSequenceNormalizerReturns 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:
-
BULLETS
-
INSTANCE
-
-
Constructor Details
-
BulletCharSequenceNormalizer
public BulletCharSequenceNormalizer()
-
-
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.
-
readResolve
Returns the shared instance, so deserialization keeps the singleton.- Returns:
- the shared instance, so deserialization keeps the singleton
-