HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/nltk/stem/util.py
# Natural Language Toolkit: Stemmer Utilities
#
# Copyright (C) 2001-2024 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) :]