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 normalizer that performs such a fold over the cursor-based CharClass engine can record those edits and expose them through normalizeAligned(CharSequence). A normalizer that delegates to Normalizer (NFC/NFKC) or to a stemmer cannot report its edits and does not implement this interface.

Callers check for the capability with normalizer instanceof OffsetAwareNormalizer, the same way OffsetMappingNameFinder is detected on a name finder.

Since:
3.0.0