Skip to content

methods should be private in normalizer class #40

Description

@jfdev001

def normalize_special_characters(self, text: str) -> str:
"""Replace or remove special characters (return text if no change).
In some languages, like German, special characters like "ß" can be
noramalized to written as "ss" and this does not change meaning.
However, for languages like Italian, there is a difference between "è"
and "e", so no special characters normalization is implemented for
that.
"""
pass
def normalize_case(self, text: str) -> str:
return text.lower()
def normalize_punctuation(self, text: str) -> str:
all_chars_except_words_and_single_spaces = r"[^\w\s]"
space = " "
return sub(
pattern=all_chars_except_words_and_single_spaces,
repl=space,
string=text,
)
def normalize_whitespace(self, text: str) -> str:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions