147template<
typename Predicate>
150 [pred = std::forward<Predicate>(predicate)](
const Rune& rune) {
154 "Remove characters matching predicate"
163template<
typename Predicate>
166 std::forward<Predicate>(predicate),
168 "Keep only characters matching predicate"
177template<
typename Transform>
180 std::forward<Transform>(transform),
182 "Transform each character"
Represents a single textual unit with Unicode and linguistic properties.
Unified spell object for text transformation.
Language identification and localization support.
auto filter_spell(Predicate &&predicate, std::string name="FilterSpell", std::string description="Rune filtering")
Create a spell that filters runes based on a predicate.
auto per_rune_spell(RuneTransform &&rune_transform, std::string name="PerRuneSpell", std::string description="Per-rune transformation")
Create a spell that applies a transformation to each rune.
Pre-defined spells using the unified Spell interface.
const Spell text_cleanup
Standard text cleanup (whitespace + NFC + lowercase)
Spell keep_if(Predicate &&predicate)
Create a spell that keeps only characters matching a predicate.
Spell detect_language()
Create a language detection spell.
Spell filter_by_script(unicode::Script script, bool keep=true)
Create a script filtering spell.
const Spell to_uppercase
Convert text to uppercase.
const Spell unicode_nfkd
Apply Unicode NFKD normalization.
const Spell alphanumeric_only
Keep only letters and digits.
const Spell search_preprocess
Search-optimized preprocessing.
const Spell remove_digits
Remove digits.
const Spell remove_punctuation
Remove punctuation characters.
const Spell to_lowercase
Convert text to lowercase.
Spell whitespace(bool collapse_multiple=true, bool trim_edges=true)
Create a custom whitespace normalizer.
const Spell ascii_only
Keep only ASCII characters.
const Spell collapse_whitespace
Collapse multiple whitespace into single spaces.
Spell remove_if(Predicate &&predicate)
Create a spell that removes characters matching a predicate.
Spell replace_string(std::string_view from, std::string_view to)
Create a string replacement spell.
Spell replace_char(char32_t from, char32_t to)
Create a character replacement spell.
const Spell to_titlecase
Convert text to title case.
const Spell display_format
Display-optimized formatting.
const Spell whitespace_normalizer
Normalize whitespace characters.
const Spell unicode_nfkc
Apply Unicode NFKC normalization.
Spell filter_by_category(unicode::Category category, bool keep=true)
Create a category filtering spell.
const Spell unicode_nfd
Apply Unicode NFD normalization.
const Spell trim_whitespace
Trim leading and trailing whitespace.
const Spell unicode_nfc
Apply Unicode NFC normalization.
Spell transform_chars(Transform &&transform)
Create a spell that transforms each character.