def remove_punc()

in src/utils/str.py [0:0]


def remove_punc(text: str, lowercase=False):
    if not text:
        return text
    text = text[:-1] if text[-1] in PUNCTUATION and text[-1] not in '>】’”)}]\'"' else text
    if lowercase:
        word0 = text.split()[0]
        if word0[1:].lower() != word0[1:]:
            pass
        else:
            text = text[:1].lower() + text[1:]
    text = re.sub(INVALID_PUNC, "", text).strip()
    return text