File size: 644 Bytes
d916065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Natural Language Toolkit: Stemmer Utilities
#
# Copyright (C) 2001-2023 NLTK Project
# Author: Helder <[email protected]>
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT


def suffix_replace(original, old, new):
    """

    Replaces the old suffix of the original string by a new suffix

    """
    return original[: -len(old)] + new


def prefix_replace(original, old, new):
    """

    Replaces the old prefix of the original string by a new suffix



    :param original: string

    :param old: string

    :param new: string

    :return: string

    """
    return new + original[len(old) :]