Text normalization for the search pipeline.
Handles:
- Lowercasing (Unicode-aware via
String.downcase/2) - Unicode normalization (NFC form)
- Punctuation and special character removal
The normalizer runs after tokenization but could also be applied to the full text before tokenization.
Summary
Functions
Normalizes a single term.
Normalizes a list of terms, removing any that normalize to nil or empty.
Functions
Normalizes a single term.
Applies lowercase, NFC normalization, and strips surrounding punctuation.
Returns nil if the term becomes empty after normalization.
Examples
iex> Normalizer.normalize_term("Phoenix!")
"phoenix"
iex> Normalizer.normalize_term(" ELIXIR ")
"elixir"
iex> Normalizer.normalize_term("!!!")
nil
Normalizes a list of terms, removing any that normalize to nil or empty.