Rune Caster 1.0.0
Modern C++ Text Processing Framework
Loading...
Searching...
No Matches
rune_caster::spells Namespace Reference

Pre-defined spells using the unified Spell interface. More...

Functions

Spell whitespace (bool collapse_multiple=true, bool trim_edges=true)
 Create a custom whitespace normalizer.
Spell replace_char (char32_t from, char32_t to)
 Create a character replacement spell.
Spell replace_string (std::string_view from, std::string_view to)
 Create a string replacement spell.
template<typename Predicate>
Spell remove_if (Predicate &&predicate)
 Create a spell that removes characters matching a predicate.
template<typename Predicate>
Spell keep_if (Predicate &&predicate)
 Create a spell that keeps only characters matching a predicate.
template<typename Transform>
Spell transform_chars (Transform &&transform)
 Create a spell that transforms each character.
Spell detect_language ()
 Create a language detection spell.
Spell filter_by_script (unicode::Script script, bool keep=true)
 Create a script filtering spell.
Spell filter_by_category (unicode::Category category, bool keep=true)
 Create a category filtering spell.

Variables

const Spell whitespace_normalizer
 Normalize whitespace characters.
const Spell trim_whitespace
 Trim leading and trailing whitespace.
const Spell collapse_whitespace
 Collapse multiple whitespace into single spaces.
const Spell to_lowercase
 Convert text to lowercase.
const Spell to_uppercase
 Convert text to uppercase.
const Spell to_titlecase
 Convert text to title case.
const Spell unicode_nfc
 Apply Unicode NFC normalization.
const Spell unicode_nfd
 Apply Unicode NFD normalization.
const Spell unicode_nfkc
 Apply Unicode NFKC normalization.
const Spell unicode_nfkd
 Apply Unicode NFKD normalization.
const Spell remove_punctuation
 Remove punctuation characters.
const Spell alphanumeric_only
 Keep only letters and digits.
const Spell remove_digits
 Remove digits.
const Spell ascii_only
 Keep only ASCII characters.
const Spell text_cleanup
 Standard text cleanup (whitespace + NFC + lowercase)
const Spell search_preprocess
 Search-optimized preprocessing.
const Spell display_format
 Display-optimized formatting.

Detailed Description

Pre-defined spells using the unified Spell interface.

This namespace contains commonly used spells implemented using the new unified Spell architecture. All spells are compatible with the Caster pipeline and can be composed using operator|.

Function Documentation

◆ detect_language()

Spell rune_caster::spells::detect_language ( )

Create a language detection spell.

Returns
Language detection spell

◆ filter_by_category()

Spell rune_caster::spells::filter_by_category ( unicode::Category category,
bool keep = true )

Create a category filtering spell.

Parameters
categoryThe Unicode category to filter by
keepIf true, keep only this category; if false, remove this category
Returns
Category filtering spell

◆ filter_by_script()

Spell rune_caster::spells::filter_by_script ( unicode::Script script,
bool keep = true )

Create a script filtering spell.

Parameters
scriptThe Unicode script to filter by
keepIf true, keep only this script; if false, remove this script
Returns
Script filtering spell

◆ keep_if()

template<typename Predicate>
Spell rune_caster::spells::keep_if ( Predicate && predicate)

Create a spell that keeps only characters matching a predicate.

Parameters
predicateFunction that returns true for characters to keep
Returns
Filtering spell

Definition at line 164 of file spells.hpp.

◆ remove_if()

template<typename Predicate>
Spell rune_caster::spells::remove_if ( Predicate && predicate)

Create a spell that removes characters matching a predicate.

Parameters
predicateFunction that returns true for characters to remove
Returns
Filtering spell

Definition at line 148 of file spells.hpp.

◆ replace_char()

Spell rune_caster::spells::replace_char ( char32_t from,
char32_t to )

Create a character replacement spell.

Parameters
fromCharacter to replace
toReplacement character
Returns
Character replacement spell

◆ replace_string()

Spell rune_caster::spells::replace_string ( std::string_view from,
std::string_view to )

Create a string replacement spell.

Parameters
fromString to replace
toReplacement string
Returns
String replacement spell

◆ transform_chars()

template<typename Transform>
Spell rune_caster::spells::transform_chars ( Transform && transform)

Create a spell that transforms each character.

Parameters
transformFunction that transforms individual runes
Returns
Per-character transformation spell

Definition at line 178 of file spells.hpp.

◆ whitespace()

Spell rune_caster::spells::whitespace ( bool collapse_multiple = true,
bool trim_edges = true )

Create a custom whitespace normalizer.

Parameters
collapse_multipleIf true, collapse multiple whitespace
trim_edgesIf true, trim leading/trailing whitespace
Returns
Custom whitespace normalizer spell

Variable Documentation

◆ alphanumeric_only

const Spell rune_caster::spells::alphanumeric_only
extern

Keep only letters and digits.

◆ ascii_only

const Spell rune_caster::spells::ascii_only
extern

Keep only ASCII characters.

◆ collapse_whitespace

const Spell rune_caster::spells::collapse_whitespace
extern

Collapse multiple whitespace into single spaces.

◆ display_format

const Spell rune_caster::spells::display_format
extern

Display-optimized formatting.

◆ remove_digits

const Spell rune_caster::spells::remove_digits
extern

Remove digits.

◆ remove_punctuation

const Spell rune_caster::spells::remove_punctuation
extern

Remove punctuation characters.

Examples
Basic.

◆ search_preprocess

const Spell rune_caster::spells::search_preprocess
extern

Search-optimized preprocessing.

◆ text_cleanup

const Spell rune_caster::spells::text_cleanup
extern

Standard text cleanup (whitespace + NFC + lowercase)

◆ to_lowercase

const Spell rune_caster::spells::to_lowercase
extern

Convert text to lowercase.

Examples
Basic.

◆ to_titlecase

const Spell rune_caster::spells::to_titlecase
extern

Convert text to title case.

◆ to_uppercase

const Spell rune_caster::spells::to_uppercase
extern

Convert text to uppercase.

◆ trim_whitespace

const Spell rune_caster::spells::trim_whitespace
extern

Trim leading and trailing whitespace.

◆ unicode_nfc

const Spell rune_caster::spells::unicode_nfc
extern

Apply Unicode NFC normalization.

◆ unicode_nfd

const Spell rune_caster::spells::unicode_nfd
extern

Apply Unicode NFD normalization.

◆ unicode_nfkc

const Spell rune_caster::spells::unicode_nfkc
extern

Apply Unicode NFKC normalization.

◆ unicode_nfkd

const Spell rune_caster::spells::unicode_nfkd
extern

Apply Unicode NFKD normalization.

◆ whitespace_normalizer

const Spell rune_caster::spells::whitespace_normalizer
extern

Normalize whitespace characters.

Converts various whitespace characters to standard space (U+0020) and collapses multiple whitespace into single spaces.

Examples
Basic.