import re


def normalize(string: str) -> str:
    """
    Normalize a text string.

    :param string: input string
    :return: normalized string
    """
    string = string.replace("\xef\xbb\xbf", "")                      # remove UTF-8 BOM
    string = string.replace("\ufeff", "")                            # remove UTF-16 BOM
    # string = unicodedata.normalize("NFKD", string)                   # convert to NFKD normal form
    string = re.compile(r"[0-9]").sub("0", string)                   # map all numbers to "0"
    string = re.compile(r"(?:''|``|[\"„“”‘’«»])").sub("'", string)   # normalize quotes
    string = re.compile(r"(?:[‒–—―]+|-{2,})").sub("--", string)      # normalize dashes
    string = re.compile(r"\s+").sub(" ", string)                     # collapse whitespace characters

    return string.strip()