Class DashCharSequenceNormalizer

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

public class DashCharSequenceNormalizer extends Object implements opennlp.tools.util.normalizer.OffsetAwareNormalizer
A CharSequenceNormalizer that maps every Unicode dash to an ASCII hyphen-minus (U+002D), reusing the cursor based CharClass.dashes() engine.

This folds the many dash code points (en dash, em dash, figure dash, non-breaking hyphen, fullwidth hyphen, and so on) to a single form so that "state-of-the-art" matches regardless of which dash the source used. The mathematical minus signs are left untouched by default, and U+00AD SOFT HYPHEN (a format character) is not treated as a dash.

See Also:
  • Constructor Details

    • DashCharSequenceNormalizer

      public DashCharSequenceNormalizer()
  • Method Details

    • getInstance

      public static DashCharSequenceNormalizer 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
    • normalizeAligned

      public opennlp.tools.util.normalizer.AlignedText normalizeAligned(CharSequence text)
      Specified by:
      normalizeAligned in interface opennlp.tools.util.normalizer.OffsetAwareNormalizer