Package opennlp.tools.util.normalizer

# Interface OffsetAwareNormalizer

All Superinterfaces:
  `CharSequenceNormalizer`, `Serializable`

public interface OffsetAwareNormalizer extends CharSequenceNormalizer
A `CharSequenceNormalizer` that can additionally report the `Alignment` from its normalized output back to the input, so a span found in the normalized text maps to the exact character offsets of the original.

Length-changing folds move offsets: collapsing a run of whitespace, folding a supplementary dash to one ASCII hyphen, or stripping invisible controls all shift every later character. A rung that performs such a fold over the cursor-based `CharClass` engine can record those edits and expose them through `normalizeAligned(CharSequence)`. A rung that delegates to `Normalizer` (NFC/NFKC) or to a stemmer cannot report its edits, so it does not implement this interface; that is a deliberate capability split rather than an oversight.

`TextNormalizer.Builder.buildAligned()` composes a chain of these into a single offset-aware pipeline whose `AlignedText` maps a match all the way back to the original input. An interface-typed caller tests for the capability (`normalizer instanceof OffsetAwareNormalizer`) instead of depending on a concrete rung, the same plain `instanceof` pattern used by `OffsetMappingNameFinder` (in the DL layer) rather than reflection.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AlignedText`
  `normalizeAligned(CharSequence text)`
  Normalizes `text` and returns the result together with the `Alignment` back to the input.

  ### Methods inherited from interface opennlp.tools.util.normalizer.CharSequenceNormalizer

  `normalize`

- ## Method Details

  - ### normalizeAligned

    AlignedText normalizeAligned(CharSequence text)
    Normalizes `text` and returns the result together with the `Alignment` back to the input. The normalized text is identical to `CharSequenceNormalizer.normalize(CharSequence)`: that is, `normalizeAligned(text).normalized()` equals `normalize(text).toString()`.
    Parameters:
      `text` - The `CharSequence` to normalize.
    Returns:
      The normalized text paired with its alignment to `text`.
    Throws:
      `IllegalArgumentException` - Thrown if `text` is `null`.