import json
import re


def default_cleaner(word):
    """
    The default clearner used to get the strings in shape.
    Uses the default config.json location which contains replacements
    (trouble words) and other parameters. This is closely based off
    the optimus pipeline

    Parameters
    ----------
    word : str
        a string description of some sorts

    Returns
    -------
    str
        a cleaned string

    """
    config = json.load(open('config.json'))

    w = str(word).lower()

    for regex, replacement in config['regex']:
        w = re.sub(regex, replacement, w)

    for key, value in config['trouble'].items():
        w = re.sub(key, value, w)
    return w