Class QuoteCharSequenceNormalizer

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

public class QuoteCharSequenceNormalizer extends Object implements opennlp.tools.util.normalizer.OffsetAwareNormalizer
A CharSequenceNormalizer that folds typographic quotation marks to their ASCII forms: the single quotes and apostrophes to ' and the double quotes to ".

This is high value for matching, since curly quotes, guillemets, and fullwidth quotes otherwise prevent "don't" from matching "don" + U+2019 + "t". It is built from two CharClass sets, so membership is O(1) and scanning is a single cursor pass with no regular expression. ASCII quotes are left unchanged.

See Also:
  • Constructor Details

    • QuoteCharSequenceNormalizer

      public QuoteCharSequenceNormalizer()
  • Method Details

    • getInstance

      public static QuoteCharSequenceNormalizer 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