Class LineBreakPreservingWhitespaceCharSequenceNormalizer

java.lang.Object
opennlp.tools.util.normalizer.LineBreakPreservingWhitespaceCharSequenceNormalizer
All Implemented Interfaces:
Serializable, CharSequenceNormalizer, OffsetAwareNormalizer

public class LineBreakPreservingWhitespaceCharSequenceNormalizer extends Object implements OffsetAwareNormalizer
An OffsetAwareNormalizer that collapses runs of Unicode whitespace like WhitespaceCharSequenceNormalizer, but keeps line and paragraph structure: any whitespace run that contains a line break collapses to a single newline (U+000A) instead of a space, and leading and trailing whitespace is trimmed.

This is the form wanted for readable snippets and display: horizontal runs of spaces and tabs become a single space, yet a blank line between paragraphs survives as one newline rather than being flattened into the surrounding text. It reuses the cursor based CharClass.collapsePreserving(CharSequence, CodePointSet, int) engine, so it recognizes the full Unicode White_Space set.

See Also: