File size: 153 Bytes
6124176
 
 
 
 
 
1
2
3
4
5
6
7
import re


def preprocess_text(text):
    split_punct = re.escape(r'()')
    return ' '.join(re.findall(rf"[^\s{split_punct}]+|[{split_punct}]", text))