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:

1. 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.
2. 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"`.
3. Every leading and trailing character at or below `U+0020` is dropped, the same rule `String.trim()` applies.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ShrinkCharSequenceNormalizer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ShrinkCharSequenceNormalizer`
  `getInstance()`
  Returns the shared, stateless instance.
  `CharSequence`
  `normalize(CharSequence text)`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ShrinkCharSequenceNormalizer

    public ShrinkCharSequenceNormalizer()

- ## Method Details

  - ### getInstance

    public static ShrinkCharSequenceNormalizer getInstance()
    Returns the shared, stateless instance.
    Returns:
      the shared, stateless instance

  - ### normalize

    public CharSequence normalize(CharSequence text)
    Specified by:
      `normalize` in interface `opennlp.tools.util.normalizer.CharSequenceNormalizer`