Skip to content

Text Sanitize

Text sanitization utilities.

Functions

clean(text: str) -> str

Remove extra whitespace from text.


text: The input text to clean.

str: The cleaned text with normalized whitespace.

sanitize(text: str, replacement: str = '_') -> str

Sanitize text to create safe ASCII identifiers.


text: The input text to sanitize.
replacement: The character to replace non-alphanumeric characters.

str: The sanitized text with only ASCII alphanumeric characters.

Modules

sanitize_clean

Text Cleaning

Remove extra whitespace from text.

Functions

clean(text: str) -> str

Remove extra whitespace from text.


text: The input text to clean.

str: The cleaned text with normalized whitespace.

sanitize_text

Text Sanitization

Sanitize text to create safe ASCII identifiers.

Functions

sanitize(text: str, replacement: str = '_') -> str

Sanitize text to create safe ASCII identifiers.


text: The input text to sanitize.
replacement: The character to replace non-alphanumeric characters.

str: The sanitized text with only ASCII alphanumeric characters.

options: show_root_heading: true show_source: false heading_level: 2