clean_text_rhoni.base_clean_text

Module with base class clean text

Module Contents

Classes

BaseCleanText

A utility class to clean and manipulate text

class clean_text_rhoni.base_clean_text.BaseCleanText[source]

A utility class to clean and manipulate text

transform_to_lowercase(text)[source]

Convert the input text to lowercase.

Examples

>>> transform_to_lowercase("Hello World")
"hello world"
remove_leading_trailing_spaces(text)[source]

Remove leading and trailing whitespaces from the input text.

Examples

>>> remove_leading_trailing_spaces("  hello world  ")
"hello world"
replace_multiple_spaces(text)[source]

Remove multiple spaces in the input text and replace them with a single space.

Examples

>>> replace_multiple_spaces("hello   world")
"hello world"
remove_special_characters(text)[source]

Remove special characters from the input text.

Examples

>>> remove_special_characters("Hola! cómo estás?")
"Hola cómo estás"

Notes

Special characters are characters that are neither word characters (alphanumeric and underscore) nor whitespace characters.

remove_accents(text)[source]

Remove accents from vowels in the input text.

Examples

>>> remove_accents("café")
"cafe"
remove_n_tilde(text)[source]

Remove the tilde from the n in the input text.

Examples

>>> remove_n_tilde("mañana")
"manana"
replace_spaces_by_underscores(text)[source]

Replace spaces with underscores in the input text.

Examples

>>> replace_spaces_by_underscores("hello world")
"hello_world"
replace_underscores_by_spaces(text)[source]

Replace underscores with spaces in the input text.

Examples

>>> replace_underscores_by_spaces("hello_world")
"hello world"