import re


def substitute_brackets(string: str) -> str:
    """Substitutes square brackets to work in Pynini.

    Args:
        string: A line from the corpus (one or more sentences).

    Returns: The same line with square brackets replaced by parentheses.
    """
    sub_left_bracket = re.sub(r"\[", "(", string.strip())
    sub_right_bracket = re.sub(r"\]", ")", sub_left_bracket)
    return sub_right_bracket