import re


def load_lex_mixed(file_path):
    """Loads a lexicon in (word,correction) format to a dictionary

    Args:
        file_path (str): File containing the lexicon.

    Return:
        dict(str:int): Word and frequency.
    """
    lex = {}
    with open(file_path, encoding="utf-8") as f:
        for line in f:
            if "," in line:
                lex[
                    re.sub(r"(.)\1\1+", r"\1\1\1", line.strip().split(",")[0])
                ] = re.sub(r"(.)\1+", r"\1\1\1", line.strip().split(",")[1])
            else:
                lex[re.sub(r"(.)\1\1+", r"\1\1\1", line.strip())] = 0
    return lex