Package opennlp.tools.util.normalizer
Class ShrinkCharSequenceNormalizer
java.lang.Object
opennlp.tools.util.normalizer.ShrinkCharSequenceNormalizer
- All Implemented Interfaces:
Serializable,opennlp.tools.util.normalizer.CharSequenceNormalizer
public class ShrinkCharSequenceNormalizer
extends Object
implements opennlp.tools.util.normalizer.CharSequenceNormalizer
A
CharSequenceNormalizer implementation that shrinks repeated whitespace and repeated
characters in text, in three steps:
- Each run of two or more ASCII whitespace characters (tab, line feed, vertical tab, form feed, carriage return, or space) collapses to a single space. A lone whitespace character is kept as it is.
- Each run of three or more repeats of one code point shrinks to two copies of its first
occurrence, comparing repeats case-insensitively over ASCII; a run never starts on a
line terminator. For example,
"coooool"becomes"cool". - Every leading and trailing character at or below
U+0020is dropped, the same ruleString.trim()applies.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ShrinkCharSequenceNormalizerReturns the shared, stateless instance.normalize(CharSequence text)
-
Constructor Details
-
ShrinkCharSequenceNormalizer
public ShrinkCharSequenceNormalizer()
-
-
Method Details
-
getInstance
Returns the shared, stateless instance.- Returns:
- the shared, stateless instance
-
normalize
- Specified by:
normalizein interfaceopennlp.tools.util.normalizer.CharSequenceNormalizer
-