natural language toolkit stemmer utilities c 20012023 nltk project helder he7d3rgmail com url https www nltk org for license information see license txt replaces the old suffix of the original string by a new suffix replaces the old prefix of the original string by a new suffix param original string param old string param new string return string natural language toolkit stemmer utilities c 2001 2023 nltk project helder he7d3r gmail com url https www nltk org for license information see license txt replaces the old suffix of the original string by a new suffix replaces the old prefix of the original string by a new suffix param original string param old string param new string return string
def suffix_replace(original, old, new):
    
    return original[: -len(old)] + new


def prefix_replace(original, old, new):
    
    return new + original[len(old) :]