Package opennlp.tools.util.normalizer

# Class CaseFoldCharSequenceNormalizer

java.lang.Object
opennlp.tools.util.normalizer.CaseFoldCharSequenceNormalizer

All Implemented Interfaces:
  `Serializable`, `opennlp.tools.util.normalizer.CharSequenceNormalizer`

public class CaseFoldCharSequenceNormalizer extends Object implements opennlp.tools.util.normalizer.CharSequenceNormalizer
A `CharSequenceNormalizer` that lower cases text for case-insensitive matching. It uses `Locale.ROOT` by default, so the result does not depend on the JVM's default locale.

`Locale.ROOT` avoids locale surprises such as the Turkish dotless-i mapping. A specific locale can be supplied through `CaseFoldCharSequenceNormalizer(Locale)` or `getInstance(Locale)` when a language's case rules are wanted (Turkish being the classic example). Full Unicode case folding (for example German eszett, `U+00DF`, to `ss`) is a distinct, heavier transform and is intentionally out of scope here.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CaseFoldCharSequenceNormalizer()`
  Creates a normalizer that lower cases using `Locale.ROOT`.
  `CaseFoldCharSequenceNormalizer(Locale locale)`
  Creates a normalizer that lower cases using the given locale.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CaseFoldCharSequenceNormalizer`
  `getInstance()`
  Returns the shared, stateless `Locale.ROOT` instance.
  `static CaseFoldCharSequenceNormalizer`
  `getInstance(Locale locale)`
  Returns a normalizer for the given locale.
  `CharSequence`
  `normalize(CharSequence text)`

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

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

- ## Constructor Details

  - ### CaseFoldCharSequenceNormalizer

    public CaseFoldCharSequenceNormalizer()
    Creates a normalizer that lower cases using `Locale.ROOT`.

  - ### CaseFoldCharSequenceNormalizer

    public CaseFoldCharSequenceNormalizer(Locale locale)
    Creates a normalizer that lower cases using the given locale.
    Parameters:
      `locale` - The locale whose case rules to apply.

- ## Method Details

  - ### getInstance

    public static CaseFoldCharSequenceNormalizer getInstance()
    Returns the shared, stateless `Locale.ROOT` instance.
    Returns:
      the shared, stateless `Locale.ROOT` instance

  - ### getInstance

    public static CaseFoldCharSequenceNormalizer getInstance(Locale locale)
    Returns a normalizer for the given locale. The shared `Locale.ROOT` instance is returned for `Locale.ROOT`.
    Parameters:
      `locale` - The locale whose case rules to apply.
    Returns:
      a normalizer for the given locale
    Throws:
      `NullPointerException` - Thrown if `locale` is null; call `getInstance()` for the locale-independent default.

  - ### normalize

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